I want update problem state as closed when incident state is closed
I tried this code but it is updating all the records in problem table, But I want to update only that related table.
// update the state of all active incidents to 4 - "Awaiting User Info"
var gr = new GlideRecord('incident')
gr.addQuery('active', true);
gr.query();
gr.state = 4;
gr.updateMultiple();
It sounds like you could use a little glide scripting help. Try something more like this:
You only want the one related inc record, so we make sure that the returned record matches the record in the ref field (which I've called incident_ref_field, but you should change to the actual field name).