Help me in background script filling the empty variable in catalog task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited an hour ago
Help me in background script filling the empty variable in catalog task user faced issue in closing the task Because this is a mandatory field. check the screenshot for your reference like company name is empty please write the script for filling this value .
please help me asap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I could see company name variable is having data in it.
Also check why user was able to close the task without filling mandatory variable.
you can use this sample script
updateVariable();
function updateVariable() {
try {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", "IN", "sysId1,sysId2,sysId3");
gr.query();
while (gr.next()) {
gr.variables.variableName = 'your value';
gr.setWorkflow(false);
gr.update();
}
} catch (ex) {
gs.info(ex);
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
