Catalog field should be displayed only when the catalog is s part of an order guide

Asmita7
Tera Expert

Hello friends,

 

 

 

Please suggest.

Thank you

Asmi

1 ACCEPTED SOLUTION

@Asmita7 

there is a field on RITM table order_guide

Screenshot 2026-11-11 123910.png

When RITM is generated as part of Order guide this field is populated, so you can use that logic with g_scratchpad variable

1) use Display business rule on RITM and SC Task table

BR on RITM

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	g_scratchpad.orderGuide = current.order_guide.toString();

})(current, previous);

BR on SC TASK

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	g_scratchpad.orderGuide = current.request_item.order_guide.toString();

})(current, previous);

2) then normal onLoad client script on sc_req_item and sc_task and Not Catalog client script

function onLoad() {

    if (g_scratchpad.orderGuide != '') {
        g_form.setDisplay('variables.variableName', true); // give your variable name here
    } else {
        g_form.setDisplay('variables.variableName', false);  // give your variable name here
    }
	
}

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

View solution in original post

5 REPLIES 5

@Asmita7 

catalog client scripts don't have access to g_scratchpad variable

another way

1) create onLoad catalog client script which Applies on RITM and SC task

2) grab the RITM sysId using g_form.getUniqueValue()

3) do GlideAjax and see if order_guide field is populated or not

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏