Hi Andrew!

 

I removed the script I had, and just used what you provided. Now, it's not showing any team member records in the related list. 

MStritt_0-1737321935588.png

 

Not applicable

Thats a relatively good start at least its picking up the script.

On the sn_customerservice_case table try using the field name where the account team members are mentioned and use the below.

(function refineQuery(current, parent) {

current.addQuery(<"Account team members field">, parent.sys_id);

})(current, parent);





There isn't a team members field on the Case table. When you create a team member, there is an Account field, where the user is added to. The example below, I'm adding Clark Kent as a Sales Representative to 'The Daily Planet' Account. If I go to the The Daily Planet Account record and look at the Account Team Members related list tab, I'll see this record. What I want to do, is create a relationship between the Case table and Account Team Members table, so if a Case is created against the Daily Planet, I want to see the Account Team members related list tab on the Case form, and see that Clark Kent is the Sales Representative for that Account. The like field between the Case table and Account Team Members tables, is the Account field.

 

MStritt_0-1737323075903.png

 

Not applicable

Hi @MStritt 

Okay, in that case try this one...

(function refineQuery(current, parent) {
    // Ensure the 'account' field from the parent case matches the 'account' field in the account team members table
    current.addQuery("account", parent.account);
})(current, parent);

View solution in original post

That did it. Thanks!