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

Ankur Bawiskar
Tera Patron

@Asmita7 

is this a dictionary field on RITM table or variable associated to your catalog item?

Sorry for the confusion @Ankur Bawiskar . It is a catalog variable.

@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! 🙏

Thank you very much @Ankur Bawiskar for your time . But I have been asked to create functionality on catalog item itself. Not allowed to write any script on RITM or Catalog Task.

Can we achieve that way only writing script on catalog item?

Thank you