Thursday, 15 March 2012

When sending email getting message "Some error occured"


When sending an email on change of ownership of record, I was getting error "some error occurred", to resolved it set the caller id "on behalf of" as below


            EntityReference callingUser = new EntityReference
            {
                LogicalName = "systemuser",
                Id = localContext.PluginExecutionContext.InitiatingUserId
            };

            OrganizationServiceProxy serviceProxy = (OrganizationServiceProxy)crmService;
            serviceProxy.CallerId = callingUser.Id;

No comments:

Post a Comment