Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

User Profile that shows the users related RITM, REQ , INC

Ken61
Giga Guru

I have a requirement to create a relationship and add it to the tabs on user profile. This will enable the user to be able to see which related records a user has from the user record so this will allow us to view related tickets when we identify the user's name.

View a Related List to the User Profile that shows the users related RITM, REQ , INC record. Screenshot below.

I did created the relationship on the task table but unable to display RITM,REQ and INC where caller and requested for is the user.

Ken61_0-1715271356509.png

This was my relationship script:

(function refineQuery(current, parent) {

current.addQuery('sys_id', parent.request_item);

})(current, parent);

 

1 ACCEPTED SOLUTION

magee
Tera Guru

 

 

Try this:

 

magee_0-1715281137029.png

 

 

 

(function refineQuery(current, parent) {
current.addEncodedQuery('opened_by='+parent.sys_id+'^numberSTARTSWITHRITM^ORnumberSTARTSWITHREQ^ORnumberSTARTSWITHINC');
})(current, parent);

 

 

 

End result:

 

magee_1-1715281198154.png

 

View solution in original post

1 REPLY 1

magee
Tera Guru

 

 

Try this:

 

magee_0-1715281137029.png

 

 

 

(function refineQuery(current, parent) {
current.addEncodedQuery('opened_by='+parent.sys_id+'^numberSTARTSWITHRITM^ORnumberSTARTSWITHREQ^ORnumberSTARTSWITHINC');
})(current, parent);

 

 

 

End result:

 

magee_1-1715281198154.png