Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Answered

Count the number of days since the last cuntact was created per account

Posted on by 385

Hi,

I have the following request I'm not sure how to implement it right.  I would like to set up a field in account which shows me the number of days that past from the last contact created that is associated to this account. 

Does anyone have an idea how to implement this?

thanks 

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Count the number of days since the last cuntact was created per account

    Hi,

    You can achieve this functionality as follows:

    1. Create a two option set on contact, say "New Contact added?" (default = No)

    2. write a workflow that will set the counter on the account as 0

    2. You need to write another custom workflow called on create of contact where you have to check if New Contact added = No then wait for

    1day and increment the counter on the account by 1 and in your custom workflow set all the contact associate to that account as New Contact added? = Yes except for the current record and call this as the child process.

  • alexyou Profile Picture
    alexyou 385 on at
    RE: Count the number of days since the last cuntact was created per account

    I managed to do it using WF.

    Thanks Mihir

  • alexyou Profile Picture
    alexyou 385 on at
    RE: Count the number of days since the last cuntact was created per account

    Hi Mihir,


    exactly what I tried to do but without success.


    I created a workflow which runs after contact created and it's supposed to update the related account with data create of the contact unfortunately the WF fails - reason "Cannot find record to be updated":

    Plugin Trace:
    
    [Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.UpdateEntity]
    [UpdateStep1]
    
    
    
    Error Message:
    
    Unhandled Exception: Microsoft.Crm.CrmException: Cannot find record to be updated
       at Microsoft.Crm.Workflow.Services.UpdateActivityService.Execute(ActivityContext executionContext, UpdateEntity updateEntity)
       at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
       at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
    


  • Verified answer
    Mihir@CRM Profile Picture
    Mihir@CRM 4,036 on at
    RE: Count the number of days since the last cuntact was created per account

    Hi,

    One option is to create a field on the Account called "Last Contact created" - a date field.

    Update the date field every time a contact is created for the Account.

    Than you can have a calculated field on the Account form to calculate and show the # of days since the last contact was created on the Account.

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Count the number of days since the last cuntact was created per account

    Use a Plugin to calculate the Days and Update it in the required field. Plugin can trigger on Update of the  record.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans