How to relate multiple fields to single record in related list

Marcel H_
Tera Guru

I have a custom solution that I'm developing for an internal team and I've run into a situation that I don't know that I've seen before on an OOB form, and have never had to work with before.

We have a form in which there are 6 potential fields that can be filled in with a person's name. The name is retrieved from a reference table that is modeled to be similar to the sys_user table (but not an extension). The table contains specific individuals that are principal stakeholders, and 1 or all of them can be referenced as part of this form as seen below:

find_real_file.png

I also want to have a related list on the principal records in the reference table so we can see which records they have been added to as a principal (in much the same way that a user is associated with an Incident). The problem that I'm having though is that when I go to the related list configuration, what I see is that each of the Principal fields is listed, or an over all relation to the record in question. Problem is that the Principal could be added in any order to any of the above fields, and I don't want to add 6 different related lists to capture what record they are associated with depending on the field they've been added to:

find_real_file.png

There is also the related list GST AARs, but when added that seems to require that the record be added manually, which I know will not get done once the solution is turned over to the team that will use it.

find_real_file.png

I just need a good automated way to show a related list that populates when any of the principal users is on the form in any of these fields. Any advice is greatly appreciated.

1 ACCEPTED SOLUTION

Marcel H_
Tera Guru

Ok, looks like I figured it out. Created a new relationship between the tables I'm using and used the following script on the relationship record



currentrecord.addQuery('u_principal_1', parent.u_principal_1);


currentrecord.addQuery('u_principal_2', parent.u_principal_2);


currentrecord.addQuery('u_principal_3', parent.u_principal_3);


currentrecord.addQuery('u_principal_4', parent.u_principal_4);


currentrecord.addQuery('u_principal_5', parent.u_principal_5);


currentrecord.addQuery('u_principal_6', parent.u_principal_6);



From there I created a related list and used the REL:"sys_id" of the previously created relationship to control what the list displays.


View solution in original post

1 REPLY 1

Marcel H_
Tera Guru

Ok, looks like I figured it out. Created a new relationship between the tables I'm using and used the following script on the relationship record



currentrecord.addQuery('u_principal_1', parent.u_principal_1);


currentrecord.addQuery('u_principal_2', parent.u_principal_2);


currentrecord.addQuery('u_principal_3', parent.u_principal_3);


currentrecord.addQuery('u_principal_4', parent.u_principal_4);


currentrecord.addQuery('u_principal_5', parent.u_principal_5);


currentrecord.addQuery('u_principal_6', parent.u_principal_6);



From there I created a related list and used the REL:"sys_id" of the previously created relationship to control what the list displays.