create a button in ribbon for update a entity using a plugin in crm 2011

馋奶兔 提交于 2019-12-08 12:23:04

问题


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.


回答1:


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).




回答2:


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.



来源:https://stackoverflow.com/questions/20134705/create-a-button-in-ribbon-for-update-a-entity-using-a-plugin-in-crm-2011

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!