Hi Team, I have created a field in the sc_task called "Item in good condition?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 12:18 AM
Hi Team,
I have created a field in the sc_task called "Item in good condition?". However, when the RITM state is deployment prep, the "Item in good condition?" field needs to be visible for a specific catalog task.
Please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 12:46 AM
Hi @AA6 ,
You can write On Load Client Script and Client Callable Script Include.
- Find the identifier in Catalog task for which you want to change the behaviour of your field ("Item in good condition",true). Then put the condition in if Condition -> If it is true then write below code inside the condition.
- In On Load Client script you can send the value of RITM field to script include.
- Now in script include do a glide record in RITM table.
- In addquery gr.addQuey("Number",this,getParameter("ritm_num"));
- if RITM state = deployment prep then return true else return false.
- In client script if response is true then g_form.setVisible("Item in good condition",true) else g_form.setVisible("Item in good condition",false)
If my response helped, please hit the Thumb Icon and accept the solution so that it benefits future readers.
Regards,
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 12:54 AM
Did you create a new state value on RITM for that?
if yes then you can use onLoad client script on sc_task and display business rule on sc_task for that
Display Business rule:
(function executeRule(current, previous /*null when async*/) {
// Initialize g_scratchpad
g_scratchpad.showItemConditionField = 'false';
// Check if the RITM state is 'deployment_prep' ensure you give correct choice value to compare
if (current.request_item.state == 'deployment_prep' && current.short_description == 'Your Specific Task Short Description') {
g_scratchpad.showItemConditionField = 'true';
}
})(current, previous);
onLoad client script:
function onLoad(){
// Check the value of g_scratchpad.showItemConditionField
if (g_scratchpad.showItemConditionField == 'true') {
// Make the 'Item in good condition?' field visible
g_form.setDisplay('item_in_good_condition', true);
} else {
// Hide the 'Item in good condition?' field
g_form.setDisplay('item_in_good_condition', false);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader