Hi there,
I am doing migration from CRM 2016 on Premise to CRM 365 online using Kingswaysoft.
I am trying to update createdon/by, modifiedon/by fields.
I know it is not possible to map directly in Kingswaysoft but I read in some blogs that we can do it using Pre-Operation plugin.
I have registered the plugin on Pre-Operation on Account, populated createdon, modofiedon fields in holding fields but my plugin is not updating the modifiedon fields.
Is there any changes in latest versions of CRM to not allow to update modifiedon field from plugins as well?
CreatedOn updated with historic date but not modifiedon.
Below is my code to update
tracing.Trace("Before conditions");
if (entity.Attributes.Contains("sfaa_commsdate"))
{
craetedOn = (DateTime)entity.Attributes["sfaa_commsdate"];
tracing.Trace("craetedOn " + craetedOn);
}
if (entity.Attributes.Contains("sfaa_la"))
{
craetedBy = entity.Attributes["sfaa_la"].ToString();
tracing.Trace("craetedBy " + craetedBy);
}
if (entity.Attributes.Contains("lastonholdtime"))
{
modifiedOn = (DateTime)entity.Attributes["lastonholdtime"];
tracing.Trace("modifiedOn " + modifiedOn);
}
if(entity.Attributes.Contains("sfaa_local"))
{
modifiedBy = entity.Attributes["sfaa_local"].ToString();
tracing.Trace("modifiedBy " + modifiedBy);
}
entity["createdon"] = craetedOn;
entity["createdby"] = new EntityReference("systemuser", new Guid(craetedBy));
entity["modifiedon"] = modifiedOn; // DateTime.Now.AddYears(-3);
entity["modifiedby"] = new EntityReference("systemuser", new Guid(modifiedBy));
//entity.Attributes.Remove("modifiedon");
//entity.Attributes.Remove("modifiedby");
//entity.Attributes.Add("modifiedon", modifiedOn);
//entity.Attributes.Add("modifiedby", new EntityReference("systemuser", new Guid(modifiedBy)));
tracing.Trace("Updated the fields");
Thanks
krishna
*This post is locked for comments