how can i put in a check what it will check on the stock room for availability at reassigning sctask

chercm
Mega Sage

i have a catalog form created. 

 

1. how can i make it automatic populating the stock room field based on the configuration of the stock room ?

 

 

chercm_0-1706792894510.png

 

 

2. how can i put in a check for stock availability in that particular stock room of the item in the variable field before re-assigning the ticket ? 

 

chercm_0-1706792537525.png

 

 

i tried to use this but stockroom field of the form is still blank 

 

(function executeRule(current, previous /*null when async*/) {
// Check if Assignment Group is set
if (current.assignment_group.getDisplayValue() != '') {
// Query the Stockroom based on Assignment Group
var stockroomGR = new GlideRecord('alm_stockroom');
stockroomGR.addQuery('assignment_group', current.assignment_group);
stockroomGR.query();
 
// If a stockroom is found, set the Stockroom field on the catalog form
if (stockroomGR.next()) {
current.stockroom = stockroomGR.getValue('name');
}
}
})(current, previous);
0 REPLIES 0