- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 12:10 AM
Hi Team,
My requirement is to update the (state value)dropdown field value of the Purchase order based on the state of the assets in the related list on the same form.
If asset state is instock/available, then the PO state should be Received.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 12:06 AM
In BR condition,
Asset status changes to In Stock and Substatus changes to Available
stateChangePO();
function stateChangePO() {
var gr = new GlideRecord('proc_po');
gr.addQuery('number', current.po_number);
gr.query();
if(gr.next()) {
gr.status = "received";
gr.update();
}
}
Did this and it worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 01:51 AM
Hi @Swetha M
You need to achieve it using After Business Rule on Asset table with condition as Asset State is InStock OR Available.
There must be a field on Asset which is referring to Purchase Order table to link between the two.
In The BR you will create, update the state field of that Purchase Order Reference field value to required state.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 12:06 AM
In BR condition,
Asset status changes to In Stock and Substatus changes to Available
stateChangePO();
function stateChangePO() {
var gr = new GlideRecord('proc_po');
gr.addQuery('number', current.po_number);
gr.query();
if(gr.next()) {
gr.status = "received";
gr.update();
}
}
Did this and it worked fine.