Update field value on a form based on value in related list

Swetha M
Mega Guru

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.

1 ACCEPTED SOLUTION

Swetha M
Mega Guru

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. 

View solution in original post

2 REPLIES 2

anubhavritolia
Giga Sage

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.

 

 

Swetha M
Mega Guru

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.