- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 10:48 AM
Greetings! I have an issue that I hope someone can assist with. I have a custom application that we use to comply with Secure Supply Chain requirements. This application utilizes the Transfer Orders capability within servicenow. On a few occasions, when transfer order lines are removed from a transfer order, the asset does not clear the active_to field. This naturally causes issues. We wrote a UI action script to clear the active_to field and set the substatus of the asset to Available instead of Pending transfer. The script worked in Quebec however it is not working in San Diego. I have created ACL's to allow editing of fields but the Active_to field seems immuatable. Can someone assist me with clearning the active_to field for the record we are viewing?
UI Action.onclick = fixAssset()
UI Action.condition = current.install_status==6&¤t.substatus=='pending_transfer'
function fixAsset() {
var recordID = g_form.getUniqueValue();
//alert(recordID);
var gr = new GlideRecord('alm_hardware');
gr.addQuery('sys_id', recordID);
gr.query();
//alert('Record count: ' + gr.rows.length);
while (gr.next()) {
//alert('Setting Active Txfr Order to false');
gr.active_to = 'false';
//alert('Setting substate to Available');
gr.substatus = 'available';
//alert('Saving Record');
gr.update();
}
action.setRedirectURL(current);
}
requires role = admin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 11:32 AM
That field is "Read only" in my instance, it is defined on the parent table of alm_hardware:
You'll need to override that as a start. And the script you have seems more appropriate for use in a Bussiness rule or other server-side means. What does you 'alert' statement show? check the return value of the 'gr.update();'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 11:32 AM
That field is "Read only" in my instance, it is defined on the parent table of alm_hardware:
You'll need to override that as a start. And the script you have seems more appropriate for use in a Bussiness rule or other server-side means. What does you 'alert' statement show? check the return value of the 'gr.update();'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 11:37 AM
Your UI Action can run on either the client or server, see:
and check to see that it is configured to run on server-side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 11:41 AM
Wow...I am a total idiot. Easiest solution. I thought it was an ACL on the table so I created a write rule on alm_asset.active_to.
As for the script being more appropriate for another use, I am still learning how to do things but when I tried client side it wouldn't work so I tried using server side and it worked in Quebec.
Thank you for the read-only attribute. I cannot believe I didn't check the table first. DERP!