I am having serious problems updating the record that was just created with some additional data.
Case: I have sms activity. Create an sms entry. The plugin starts the actual sending of SMS. A third-party sms provider takes care of the sending and returns a status bar. Based on this line, you need to update the status for sms.
Here are some of my codes:
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(
typeof(IOrganizationServiceFactory));
IOrganizationService service =
serviceFactory.CreateOrganizationService(context.UserId);
aContext orgContext = new aContext(service);
Entity sms = (Entity)context.InputParameters["Target"];
sms.StatusCode = new OptionSetValue(statuscode);
service.Update(sms);
}
I have a bug in the plugin every time I run the plugin. Can someone help and explain to me what I'm doing wrong here?
Thank!
source
share