Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Incident Resolution : Populate Empty fields

Posted on by 1,545

I know we can't run workflows on the Incident Resolution Entity.

I'm actually looking for a solution to populate some fields on this entity, upon case resolution.

For example, we need to have some data in the "actualstart" field, which is currently left empty.

In the end, actualstart should be the same as createdon.

Are there any tools out there that could help? Otherwise I guess we will need to write a plugin.

Thanks!

*This post is locked for comments

  • yleclerc Profile Picture
    yleclerc 1,545 on at
    RE: Incident Resolution : Populate Empty fields

    Thanks very much Francesco. I have been caught in another project for the past few days. But I will definitely give this code a shot when I have the chance. I will post my result then!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Incident Resolution : Populate Empty fields

    Hi Yleclerc,

    write a plugin using the following code:

    public void Execute(IServiceProvider serviceProvider)
    {
    	IPluginExecutionContext context = (IPluginExecutionContext)
    	serviceProvider.GetService(typeof(IPluginExecutionContext));
    	 
    	if (context.InputParameters.Contains("IncidentResolution"))
    	{
    		IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    		IOrganizationService service = factory.CreateOrganizationService(context.UserId);
    		
    		Entity incidentresolution = (Entity)context.InputParameters["IncidentResolution"];
    		Guid incidentid = ((EntityReference)incidentresolution.Attributes["incidentid"]).Id;
    		
    		Entity incidentent = service.Retrieve("incident", incidentid, new ColumnSet(true));
    		DateTime createdon = (DateTime)incidentent.Attributes["createdon"];
    		 
    		Entity incident = new Entity("incident");
    		incident.Id = incidentid;
    		incident.Attributes["actualstart"] = createdon;
    		service.Update(incident);
    	}
    }

    Let me know.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Incident Resolution : Populate Empty fields

    I think you can register a plugin on the incident resolution..

  • Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: Incident Resolution : Populate Empty fields

    Are u using online or on premise

  • Suggested answer
    Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: Incident Resolution : Populate Empty fields

    Its a system entities & you can't customize it for online. Am not sure about on premise

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans