web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Deactivated contact still show associated with the relevant account

(0) ShareShare
ReportReport
Posted on by 15

Is there anyway to associate a contact who no longer works with an account, still with the account they have parted ways with?

I would like to see the past contact associated with the account they are no longer involved with, but with perhaps reduced functionality (so that no tasks / appointments ect. can be made with them), & viewed different, i.e. shown in a lighter colour?

I have the same question (0)
  • Suggested answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Partner,

    Inactive contacts won't display in Account's CONTACTS subgrid, that's OOB design.

    However, due to association between them still exist, we can retrieve all associated contacts under a specific account even if some of contacts were inactive,

    and distinct active contacts and inactive contacts by contact's statecode field.(0 stands for active, 1 stands for inactive, see reference about contact entity)

    Thus you could insert a web resource to Account form, create a custom HTML table from retrieved data and give special text color for inactive contact records.

    There is a helpful tool to generate retrieving code quickly:

    https://github.com/jlattimer/CRMRESTBuilder

    Choose contact_customer_accounts relationship.(account to contact, 1:N)

    pastedimage1578987359965v2.png

    All related contacts will be expanded in JSON result.

    pastedimage1578987256132v1.png

    Regards,

    Clofly

  • cloflyMao Profile Picture
    25,210 on at

    My demo:

    pastedimage1578988575083v1.png

    Code:

    
        
        Custom table for related contacts
        
        
       
    
      
        

    Related contacts

  • Suggested answer
    cloflyMao Profile Picture
    25,210 on at

    I also build a pagination version if there were many related contacts under current account.

    
      
      Custom table for related contacts
      
      
      
      
    
    
    
      

    Related contacts

    There are 7 contacts under Farbrikam in my environment, show 5 records for each page.

    You can change pageSize property to other number to meet your requirement.

    Result:

    pastedimage1578992184793v1.png

    pastedimage1578992089832v1.png

    Regards,

    Clofly

  • Suggested answer
    Paul_Owen Profile Picture
    2,027 on at

    There is an OOB way of doing this for exactly the use case you stated using Connections.

    docs.microsoft.com/.../create-connections-view-relationships-between-records

    Regards

    Paul

  • BJ89 Profile Picture
    15 on at

    Thanks for the demo, could you send it through as an attachment, I just cannot view it.

  • cloflyMao Profile Picture
    25,210 on at

    Hi BJ89,

    Could you teach me that how to send code as an attachment?

    Regards,

    Clofly

  • cloflyMao Profile Picture
    25,210 on at

    Can you view it on JSFiddle?

    https://jsfiddle.net/pjku68d5/

    If so, then copy code directly as HTML web resource.

  • BJ89 Profile Picture
    15 on at

    I can view it larger now, so are you proposing that the background colour is a different colour when the contact is no longer employed at an account? Does this mean the contact can still be viewed at their previous account, but the background colour is changed to e.g. red? If so how is the different colour activated?

  • cloflyMao Profile Picture
    25,210 on at

    Statecode(I name that column Status) is the field for us to distince active/inactive contacts.

    You can change background to color you like, just change hex code in template function.

    function template(data) {
      var html = "";
      html += "<tr><th>Name</th><th>Email</th><th>Status</th></tr>";
      $.each(datafunction(indexitem) {
        if (item["statecode"=== 1) {
          html += "<tr style=\"background-color: #f3c869\">";
        } else {
          html += "<tr>";
        }
        html += "<td>" + item["fullname"+ "</td>";
        html += "<td>" + item["emailaddress1"+ "</td>";
        html += "<td>" + item["statecode"+ "</td>";
        html += "</tr>";
      });
      return html;
    }
  • cloflyMao Profile Picture
    25,210 on at

    Hi Partner,

    Please let me know whether you still have any other questions.

    If you had found any answer helped to solve your question, please kindly mark as verified to close the thread,

    it would be greatly appreciated.

    Regards,

    Clofly

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans