Answered by:
Plugin to update record when another record is created

Question
-
Dear all,
My business need is as follows:
1 - I have 2 Entities: lets call them A & B
2 - Entity A have a lookup field on Entity B
3 - When a new record of entity B is created, I need to update all records from enity A with the new record
Could anybody please guide me to start doing this using a custom plugin on CRM 2011 ??
I do not need a ready to use code, I just need to start point to start writing plugins, (I know how to register plugins and I have read many articles that works with the SDK sample), but It looks like this is not enough
Monday, June 6, 2011 10:25 AM
Answers
-
I think you are just repeating the same so I'm afraid I can't help. I noticed you posted the same question multiple times:
http://social.microsoft.com/Forums/en/crmdevelopment/thread/4fdbf509-fefb-4603-9a85-c10fad32a464
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/bfc45d3f-1e87-417e-99ee-5563f6762bab/
Have you read the links that other users have kindly provided?
For your scenario, you can most likely make use of RetrieveMultiple to retrieve the A records and the use an Update on each of those records. You can familiarize yourself with plugins using the links other users provided, I don't think you will get the exact code you need fromt he forums because your details are a bit unclear.
Gonzalo | gonzaloruizcrm.blogspot.com
- Marked as answer by Andrii ButenkoMVP, Moderator Saturday, October 15, 2011 12:46 AM
Monday, June 6, 2011 1:19 PMModerator
All replies
-
3 - When a new record of entity B is created, I need to update all records from enity A with the new record
So if a new recrord B is created, you want to edit *every* A record that exists in the system? Or you need to update only the A record that is in the lookup of the newly created B entity?Gonzalo | gonzaloruizcrm.blogspot.com
Monday, June 6, 2011 12:19 PMModerator -
Still unclear, so there are multiple A records per B records (B has a lookup to A).
When you create a B entity, you want to update the parent of the newly created record (the A record that is associated to the B record) or *ALL* A records in the system?
Perhaps you can provide an exmaple with more details so you can actually get some useful help in the forums...
Gonzalo | gonzaloruizcrm.blogspot.com
Monday, June 6, 2011 1:05 PMModerator -
I think you are just repeating the same so I'm afraid I can't help. I noticed you posted the same question multiple times:
http://social.microsoft.com/Forums/en/crmdevelopment/thread/4fdbf509-fefb-4603-9a85-c10fad32a464
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/bfc45d3f-1e87-417e-99ee-5563f6762bab/
Have you read the links that other users have kindly provided?
For your scenario, you can most likely make use of RetrieveMultiple to retrieve the A records and the use an Update on each of those records. You can familiarize yourself with plugins using the links other users provided, I don't think you will get the exact code you need fromt he forums because your details are a bit unclear.
Gonzalo | gonzaloruizcrm.blogspot.com
- Marked as answer by Andrii ButenkoMVP, Moderator Saturday, October 15, 2011 12:46 AM
Monday, June 6, 2011 1:19 PMModerator -
Hello Gonzalo,
You should read following thread - http://social.microsoft.com/Forums/en-US/crm/thread/558983ef-66f9-44b0-b601-a2bc63fc929b/#ecdcadf3-21ad-4118-bfb2-6330137f2aa5
You should not waste your time (at least for starter of current thread ;) )
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)Monday, June 6, 2011 1:26 PMModerator