Answered by:
Trigger plugin from javascript crm 2011

Question
-
Hi,
Because custom wfs are not supported in crm 2011 online i will required javascript to trigger plugins from button events so,please give me solution.
Any help will be appriciated!
Wednesday, May 11, 2011 1:43 PM
Answers
-
You can accomplish this by creating a custom entity you want to use as a trigger. You attach your plugin to that entity either at the create message or the update message (requires you to have one record created that you update).
Now, in Jscript, when you want to call the entity all you have to do is call the update or create for that custom entity (depending on which message you attached your plugin to). This way you can fire your plugin from anywhere you can access jscript.
For examples of create and update messages in jscript in CRM 2011 consult these resources:
http://mileyja.blogspot.com/2011/04/how-to-use-update-requests-in-net-and.html
http://mileyja.blogspot.com/2011/04/create-requests-in-net-and-jscript-in.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, May 11, 2011 3:12 PM
- Marked as answer by Ravi_Crm Friday, January 20, 2012 11:26 AM
Wednesday, May 11, 2011 3:12 PMModerator -
Hello Ravi,
You can replace custom workflow action with plugin. Please check following article - http://blogs.msdn.com/b/crm/archive/2010/11/05/custom-workflow-actions-in-microsoft-dynamics-crm-2011-online.aspx
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)- Marked as answer by Jim Glass Jr Wednesday, May 11, 2011 4:27 PM
Wednesday, May 11, 2011 3:48 PMModerator
All replies
-
Hi Ravi,
As opposed to workflows/dialogs, plugins cannot be executed on demand, they are triggered when a message is called on a specific entity so unless you call that message on the entity, the plugin will not trigger. However, I'm not sure what that has to do with the fact that custom workflow activities are not supported in CRM Online.
I suggest you also take alook at this post which provides a workaround for custom workflow activities in CRM Online: http://blogs.msdn.com/b/crm/archive/2010/11/05/custom-workflow-actions-in-microsoft-dynamics-crm-2011-online.aspx
- Proposed as answer by Gonzalo Ruiz RModerator Wednesday, May 11, 2011 3:50 PM
Wednesday, May 11, 2011 1:49 PMModerator -
You can accomplish this by creating a custom entity you want to use as a trigger. You attach your plugin to that entity either at the create message or the update message (requires you to have one record created that you update).
Now, in Jscript, when you want to call the entity all you have to do is call the update or create for that custom entity (depending on which message you attached your plugin to). This way you can fire your plugin from anywhere you can access jscript.
For examples of create and update messages in jscript in CRM 2011 consult these resources:
http://mileyja.blogspot.com/2011/04/how-to-use-update-requests-in-net-and.html
http://mileyja.blogspot.com/2011/04/create-requests-in-net-and-jscript-in.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, May 11, 2011 3:12 PM
- Marked as answer by Ravi_Crm Friday, January 20, 2012 11:26 AM
Wednesday, May 11, 2011 3:12 PMModerator -
Hello Ravi,
You can replace custom workflow action with plugin. Please check following article - http://blogs.msdn.com/b/crm/archive/2010/11/05/custom-workflow-actions-in-microsoft-dynamics-crm-2011-online.aspx
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)- Marked as answer by Jim Glass Jr Wednesday, May 11, 2011 4:27 PM
Wednesday, May 11, 2011 3:48 PMModerator -
Thanks for reply.
But my question is can i use Executeplugin(PluginGuid) method from javascript like in crm 4.0 there was one executeworkflow(objectid,GUIdWf) method check this link
https://community.dynamics.com/product/crm/crmtechnical/b/crmjimwang/archive/2008/07/02/crm-4-0-58-use-javascript-execute-47-call-47-launch-crm-workflow.aspx
from that we were directlly able to run our workflow is there anything like this in crm 2011 for plugins.
Thursday, May 12, 2011 7:03 AM -
Thursday, May 12, 2011 7:05 AMModerator
-
The answer would be no (see my previous post), it has never been possible to do such thing with plugins. In CRM 2011 you can still execute workflows from javascript though.
So Jamie has provided you a workaround for using a custom entity in order to be able to call a plugin from javascript and in my previous post you can see a guide on how to achieve custom workflow actions in CRM 2011 Online so you could call the executeworkflow from your javascript.
- Proposed as answer by Gonzalo Ruiz RModerator Thursday, May 12, 2011 11:05 AM
Thursday, May 12, 2011 11:05 AMModerator -
I like both of our solutions Gonzalo. I am not sure why Jim marked the one he did on this one.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!Thursday, May 12, 2011 1:28 PMModerator