0
votes

I create a solution in Dynamic CRM 2011 for sending SMS.

in my solution i have 2 entity,the first one for sending SMS and the second one for save Send result.

I create plugin for second entity, plugin connect to web service and check the result of sending and update the entity, so the steps for update sending statue should be like below:

1- User select one or more entity and press a custom button in ribbon

2- CRM run my plugin and connect to web service and update the result field

so i create the plug in and create the button but i don't know how to run plugin(C# Code) when button hase been pressed.

if any one know this or have better solution for update SMS result, please tell me.

note: i register a Update step and a pre Image for plugin.

please help me.

2

2 Answers

1
votes

Option 1 (no javascript or custom button):

Create a Check Send Status checkbox on the SMS entity. Move your plugin from the Send result entity to the Update of the SMS entity, and make it fire when Check Send Status is set to true. The plugin can now check the send status for the SMS and create the Send result entity with the appropriate result.

Your users can then use the multi-edit button. They can highlight multiple SMS records, click Edit and then set Check Send Status to true, which will fire your plugin.

Option 2 (custom javascript):

Write a javascript method for your button that will use the SelectedControlSelectedItemIds parameter. See here for more information: http://social.microsoft.com/Forums/en-US/79f959ac-0846-472f-bff1-4f5afe692a56/getting-selected-records-guids-in-crm-2011?forum=crm

Your javascript method needs to loop through those IDs and then create the Send result record, which should fire your existing plugin (assuming it is on Create).

0
votes

You cannot directly call a plugin from a ribbon button (indirectly you could update the record which triggers the plugin)

The javascript options above are great options, but if you would like to work within managed code:

Another option could be to connect the ribbon button to a workflow to calls a custom workflow activity that preforms whatever logic you need to preform. This will prevent you from having to trigger a plugin and instead just call on on-demand workflow.

Let me know if you need any assistance with how to do that.