- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 05:55 AM
Hello,
I have a requirement that is in the catalog item one varaible ' Current Mac Computer Asset Tag' reference to cmdb_ci_computer table. If we select asset tag in Current Mac Computer Asset Tag and if that asset tag has filewave entitlement need to visible another variable New Mac Asset Tag. Can anyone help how to achieve this logic.
Filewave entitlements are existing in alm_entitlement_asset table and in the allocated field we need to enter the asset tag.
Tried the attched script but no working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 06:07 AM
you cannot use current object.
you already have the selected record SysId in newValue
try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var gr = new GlideRecord("alm_entitlement_asset");
gr.addQuery("allocated_to", newValue);
gr.query();
if (gr.hasNext()) {
// show the other variable
}
else{
// hide the other variable
}
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 06:07 AM
you cannot use current object.
you already have the selected record SysId in newValue
try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var gr = new GlideRecord("alm_entitlement_asset");
gr.addQuery("allocated_to", newValue);
gr.query();
if (gr.hasNext()) {
// show the other variable
}
else{
// hide the other variable
}
}
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