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)
};
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?
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.
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:
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.