How to automatically update records after they've been created without opening them
-
2012. április 27. 10:50
Hi Experts,
i want to know how can i automatically update and save fields for new created records , without opening those records? Now i am using some javascript code which update those fields on the "onload event" of the form, but i have to open the records one by one and after that save the change manually .
What i want to achieve is a way to automatically update and save the change everytime new records for a specific entity (for instance: accounts) have been created.
Please let me know how to achieve it
If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise
- Szerkesztette: TheeNerd01 2012. április 27. 10:50
Az összes válasz
-
2012. április 27. 11:52Válaszadó
Hi ThreeNerd01,
This is called a PlugIn - you can learn more about writing them in the CRM2011 SDK - http://msdn.microsoft.com/en-us/library/gg328490.aspx
You would need to write a plugin that is registered on the create message pre operation stage - and then update the values in the 'target' entity image.
hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" -
2012. április 27. 12:07
This is called a PlugIn
or a workflow(if you don't want to mess with code):
http://msdn.microsoft.com/en-us/library/gg309471.aspx
Alex Shlega, GotchaHunter.Net
-
2012. április 27. 12:20Válaszadó
Good point Alex - A workflow is most definitely an option provided you don't mind the update being done at some time after the save (can be minutes later depending on how busy your system is)- so the user won't see the changes immediately when the record has been saved/updated.
hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" -
2012. április 27. 12:26
Hi Thanks Alex an Scott,
can i achieve this scenario with a workflow? how? when do i automatically know when record have been created? how while running the workflow can i call some Javascript functions?
One more question is a posssible to test a plugin without register it? do we have some tools that can help to easily an quickly write and test plugins for a specific organisation?
Thanks guys
If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise
-
2012. április 27. 12:32Válaszadó
Hi,
You can quite easily create a workflow (process) to run when a record is created, and then add an Update Action (http://msdn.microsoft.com/en-us/library/gg328264.aspx)
Without some custom workflow activities, you can't call scripts from a workflow - but the built in actions are quite flexible in terms of updating/adding records.
You can test a plugin before it is deployed, but it's quite involved (http://www.develop1.net/public/post/Unit-Testing-Dynamics-CRM2011-Pipeline-Plugins-using-Rhino-Mocks.aspx) - you might be better off starting with the example plugins in the sdk and then using tracing to see what's going on (http://msdn.microsoft.com/en-us/library/cc151092.aspx)
hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" -
2012. április 27. 12:33
Hi,
workflows are not well-suited for running "custom code". If you wanted to run custom code in your workflow, you would have to come up with a custom workflow activity.. which means you might, as well, choose a plugin instead. Well, unless you can isolate your code into a reusable workflow activity. It's worth mentioning custom activities are not supported in CRM online(not yet at least).
When creating a workflow, you can define "start" conditions. A workflow can start when a new record is created, or when a particular field(all fields) are updated, etc.
For the plugins.. I don't believe there is a "test" tool, but there are techniques for debugging the plugins:
http://msdn.microsoft.com/en-us/library/cc151088.aspx
Alex Shlega, GotchaHunter.Net