Fredrik Balstedt
Fredrik Balstedt

Reputation: 1

CRM 4 entity["name"] = "New value";

How do I update en entity for example: updateEntity["name"] = ":"... I don't understand how i should work with images (pre/post) and "New Steps" pre/post. Please give me some guidlines how I update an entity. Everyting seems to be fine exept the last step... how to update an entity with some value (string). thanks... Fred Whats wrong with the code below???

 // Obtain the target business entity from the input parmameters
                DynamicEntity entity = (DynamicEntity)context.PreEntityImages["PreServiceMobile"];// context.InputParameters.Properties["Target"];
                DynamicEntity updateEntity = (DynamicEntity)context.InputParameters.Properties["Target"];

                            updateEntity["name"] = "value";

Upvotes: 0

Views: 906

Answers (1)

Michael M
Michael M

Reputation: 398

You can only set values in the input entity during a pre stage plugin. In a post stage plugin, the entity has already been saved. If you need to update the entity in a post stage, you need to call CrmService.Update(entity)

Upvotes: 2

Related Questions