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 :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Creating Case: select Contact from Parent Account

(0) ShareShare
ReportReport
Posted on by 35

When creating a Case, we select an Account in the Customer field, and then the Contact in the Contact field. The out-of-the-box solution will cause the Contact field to show only the records that are part of the selected Account.

We just realized that if the selected Account has a Parent Account, then we cannot select Contacts of the Parent Account.

How can I reconfigure the system to allow this to happen?

For example:

  • Company A owns Company B. (Company A is the parent of Company B)
  • Employee A works at Company A.
  • Employee A calls with an issue at Company B. <-- When creating a case, I cannot select Employee A in the Contact field after I select Company B in the Customer field.

We need to do this because, in our case, the parent Account is a "Headquarters" and the child Account is an installation site. So people who work at HQ might report an IT issue at an installation site.

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi AlexEisenhart,

    Yes, you could only select the current account's contact in the Contact field on Case form. This is by design so we couldn't change this. As a workaround, you could add him as a contact in Company B for temporary. 

  • Alexander Eisenhart Profile Picture
    35 on at

    Hey . Thanks for your message! That makes sense. Is there any way for me to create a new field on Case that operates in the way that I want it to?

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi AlexEisenhart,

    Yes, you could new a many(Case) to one(Contact) relationship on the Case entity. And add it to the OOB form(Case for Interactive experience).

    Snipaste_5F00_2022_2D00_02_2D00_18_5F00_10_2D00_30_2D00_20.png

    Then you need use addCustomFilter to filter the results displayed in the Contact lookup. Create an onload event on the Case for Interactive experience and onchange event on the Customer field.

    The following is my sample code:

    var formContext,customer,parentId;
    
    function onLoad(executionContext) {
        formContext = executionContext.getFormContext();
    	customer = formContext.getAttribute("customerid").getValue();
    	
        //check customer type is account or contact
    	if(customer && customer[0].entityType == "account"){
    		
    		//get parent account id if exists
    		Xrm.WebApi.retrieveMultipleRecords("account", "?$filter=accountid eq "   customer[0].id).then(
    			function success(result){
    				if(result && result.entities.length > 0){
    					parentId = result.entities[0]["_parentaccountid_value"];
    					//filter result
    					formContext.getControl("cr2f9_contact").addPreSearch(addFilter);
    				}
    			}, 
    			function failed(error){
    				console.log(error.message);
    			}
    		);
    		
    	}
    }
    function addFilter(){
    		
    		var customerId = customer[0].id.replace("{","").replace("}","");
    		var customerAccountFilter = ""; 
    		if(parentId){
    			customerAccountFilter  = "";
    		}
    		customerAccountFilter  = ""
    		formContext.getControl("cr2f9_contact").addCustomFilter(customerAccountFilter, "contact");
    	
    }

    Test:

    Original Contact field( You could hide it on the OOB form):

    Snipaste_5F00_2022_2D00_02_2D00_18_5F00_10_2D00_38_2D00_47.png

    New created Contact field:

    Snipaste_5F00_2022_2D00_02_2D00_18_5F00_10_2D00_39_2D00_33.png

  • Walter Deworezky Profile Picture
    on at

    The easiest way to do it, is to remove the Out of the Box check

    Change the Environment variable

    msdyn_IncidentShouldValidatePrimaryContact to 0

    learn.microsoft.com/.../remove-validation-contact

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 39 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans