从功能区的JScript CRM在线2011调用C#code [英] Call C# Code from Ribbon JScript CRM Online 2011

查看:127
本文介绍了从功能区的JScript CRM在线2011调用C#code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有一些code色带上的按钮上一个实体的点击,更新CRM从一些相关的数据进行在线2011年我会preFER不要有写所有JScript中这个逻辑。有没有办法从JScript中调用到C#code?我已经看过微软从色带使用JScript的文件,它看起来是这样的:

I need to have some code execute on the click of the ribbon button on an entity that updates some related data from CRM Online 2011. I would prefer not to have to write all of this logic in JScript. Is there a way to call into C# code from JScript? I have looked at the JScript file Microsoft is using from the ribbon and it looks like this:

Mscrm.Campaign.copyCampaign = function (campaignId, saveAsTemplate) {
    var $v_0 = new RemoteCommand("MarketingAutomation", "CopyCampaign", null);
    $v_0.SetParameter("campaignId", campaignId);
    $v_0.SetParameter("saveAsTemplate", saveAsTemplate.toString());
    var $v_1 = $v_0.Execute(),
        $v_2 = $v_1.ReturnValue;
    openObj(Mscrm.EntityTypeCode.Campaign, $v_2, null, null, Mscrm.NavigationMode.NavigationModeInline, null);
    Mscrm.Utilities.refreshParentGrid(Mscrm.EntityTypeCode.Campaign, campaignId)
};

我看到被放置在一个RemoteCommand电话,我认为是要回一些网络服务功能。我希望做这样的事情。我能否添加自己的Web服务功能?

I see a RemoteCommand call being placed that I assume is going back to some web service function. I am hoping to do something like this. Can I add my own web service functions?

我是能够使从JScript中调用发送一个分配消息的实体,就像一个考验。这可能可以用一个插件,在工作​​,但它似乎有些奇怪发送消息未实际发生只是运行一些C#code(分配,更新等)执行事件,我没有看到一个方法来创建自己的消息。

I was able to make a call from JScript to send an "Assign" message for an entity just as a test. This potentially could work with a plugin-in, but it seems odd to send a message for an execution event that did not actually occur just to run some C# code ("Assign", "Update", etc.), and I don't see a way to create your own messages.

推荐答案

您不能添加自己的Web服务或在2011年创建自己的自定义插件的消息我们发现这样做的最好的方法是:

You can't add your own web services or create your own custom plugin messages in 2011. The best way we've found of doing this is to:


  1. 设置了存在专门为在服务器上运行的自定义code一个实体。

  2. 给它的属性称为消息名称和另一个属性的参数传递的任何格式你选择(XML,JSON等)

  3. 从你的JavaScript,在正确的参数创建实体传递的一个实例。

  4. 贴有该实体的消息创建一个插件,然后将其在参数并执行code你想要的任何自定义的读取。

虽然只是随机传递一个分配消息或东西可能会奏效,它在微软的眼中或许不支持的,这将是坚硬如地狱调试,如果别人曾经来看待这个系统。

While just randomly passing in an Assign message or something might work, it's probably unsupported in Microsoft's eyes, and it would be hard as hell to debug if someone else ever had to look at this system.

这篇关于从功能区的JScript CRM在线2011调用C#code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆