Request item related list modifications

Rajkumar Bommal
Tera Contributor

I have created a catalog item with some variables and i want to display same variables value records in related list and al Acceptance criteria:
i know this is done by using relation ships, and add it to related lists, 
I have done that already 
But i want to display when a variable (select box )value is in individual , other wise no records in related list 

RajkumarBommal_0-1741077423108.png

 


This is the condition i have return in the relationships:

RajkumarBommal_1-1741077444790.png

here i have used Specifiy staff variable sysid

var variableSysId = '5bdf1779833bda5091c71c29feaad3aa';
    current.addQuery('variables.' + variableSysId, parent.variables[variableSysId]);
    current.addQuery('sys_id', '!=' ,parent.sys_id);
 
2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

so are you saying if that RITM has variable as Individual in it then only it should come in related list

if variable value is not Individual then that RITM should not show in related list although other variable matches?

If yes then use this

var variableSysId = '5bdf1779833bda5091c71c29feaad3aa';

var variableSysId1 = ''; // give here the sysId of the Award Category variable
current.addQuery('variables.' + variableSysId, parent.variables[variableSysId]);
current.addQuery('sys_id', '!=' ,parent.sys_id);

current.addQuery('variables.' + variableSysId1 , "!=', 'Individual'); // give here the choice value from select box

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

are you saying if the current RITM form has Award Category Variable as Individual then only show that related list or else hide?

if yes then you can use normal onLoad client script and get the variable value and hide it

AnkurBawiskar_0-1741078298657.pngAnkurBawiskar_1-1741078309457.png

function onLoad() {
	// give correct variable name and choice value
    if (g_form.getValue('variables.awardVariableName') != 'Individual')
        g_form.hideRelatedList('REL:e1c005f91b0c2a508e08fc451a4bcbd2'); // to get the name use Right Click on list and configure List control and pick the name
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

so are you saying if that RITM has variable as Individual in it then only it should come in related list

if variable value is not Individual then that RITM should not show in related list although other variable matches?

If yes then use this

var variableSysId = '5bdf1779833bda5091c71c29feaad3aa';

var variableSysId1 = ''; // give here the sysId of the Award Category variable
current.addQuery('variables.' + variableSysId, parent.variables[variableSysId]);
current.addQuery('sys_id', '!=' ,parent.sys_id);

current.addQuery('variables.' + variableSysId1 , "!=', 'Individual'); // give here the choice value from select box

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

are you saying if the current RITM form has Award Category Variable as Individual then only show that related list or else hide?

if yes then you can use normal onLoad client script and get the variable value and hide it

AnkurBawiskar_0-1741078298657.pngAnkurBawiskar_1-1741078309457.png

function onLoad() {
	// give correct variable name and choice value
    if (g_form.getValue('variables.awardVariableName') != 'Individual')
        g_form.hideRelatedList('REL:e1c005f91b0c2a508e08fc451a4bcbd2'); // to get the name use Right Click on list and configure List control and pick the name
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes Ankur But the first one is also fine, records are not displaying if award category is not individual