Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
I am trying to update the date and time in the Custom Entity field using a plugin in MS CRM using the below code. A plugin is registered on Create message.
PluginDate value should get updated with the date using Now as I created any employee record. However, it's not working. Any help would be appreciated.
public class Test : IPlugin
public void Execute(IServiceProvider serviceProvider)
//throw new NotImplementedException();
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
Entity entity = (Entity)context.InputParameters["Target"];
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
if (entity.LogicalName == "practice_employee")
entity.Attributes["practice_PluginDate"] = DateTime.Now;
Are you triggering this logic in pre-operation step? If not register in pre-operation step and try again. It will work.
Please mark as Answer if it is helpful and provide kudos.
Blog : Dynamics 365 Key Topics (d365topicsbydk.com)
As per the Code, you should have register in Pre-Operation Mode.
If you are running in Async mode please use Post-Operation Mode and Make an Update Call so that it wil work perfect
As per MS Standard its good to go with Pre-Operation Mode
Please mark as Answer if it is helpful and provide Kudos
Subscribe : www.youtube.com/.../UCnGNN3hdlKBOr6PXotskNLABlog : microsoftcrmtechie.blogspot.com
Thanks!! can you please explain the difference between pre-operation and post-operation by considering my above code query?
Business Applications communities