- Use update function to update the record on a table.
- Update Choice field and true/false field.
var querystring = 'name=belle-uc-***';
var op = new GlideRecord('cmdb_ci_hardware');
op.addEncodedQuery(querystring);
op.query();
while(op.next())
{
gs.log('operation status -->' +op.operational_status.getDisplayValue());
gs.log('Monitor-->' +op.monitor);
gs.log('category-->' +op.category);
//Operational status is a choice field. So, pass value in setting
//Monitor is a true / false field
op.operational_status = "4";
op.monitor = "false";
op.category = "testing"
op.update();
gs.log('operation status -->' +op.operational_status.getDisplayValue());
gs.log('Monitor-->' +op.monitor);
gs.log('category-->' +op.category);
}
Before script is executed:
After script is executed:
No comments:
Post a Comment