- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2018 02:19 AM
Hi,
I tried the update the incident state to 'resolved', after click on 'Withdrawal' button by customer.
if (input && input.action) {
var action = input.action;
// If Incident table
if (data.table == 'incident') {
if (action == 'withdrawal') {
// Withdrawal Incident
gr.setValue('incident_state', 6);
gr.setValue('state', 6);
//gr.setValue('close_code', 'Resolved by Caller');
//gr.setValue('close_notes', 'test data by user');
gr.setValue('resolved_by', gs.getUserID());
gr.setValue('resolved', gs.nowDateTime());
gr.update();
}
}
While updating the incident, it creating a new incident with same incident number and different sys_id and updating as 'resolved'.
is anyone faced the same issue or any suggestion in above code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2018 04:04 AM
Can you confirm if "Withdrawal" is present on incident table and if yes please use following:
if (input && input.action) {
var action = input.action;
// If Incident table
if (data.table == 'incident') {
if (action == 'withdrawal') {
// Withdrawal Incident
var gr = new GlideRecord(data.table);
gr.addQuery('sys_id', data.sys_id);
gr.query();
if(gr.next()){
gr.setValue('incident_state', 6);
gr.setValue('state', 6);
gr.setValue('resolved_by', gs.getUserID());
gr.setValue('resolved', gs.nowDateTime());
gr.update();
}
console.log('new sys_id :'+String(gr.sys_id));
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2018 04:04 AM
Can you confirm if "Withdrawal" is present on incident table and if yes please use following:
if (input && input.action) {
var action = input.action;
// If Incident table
if (data.table == 'incident') {
if (action == 'withdrawal') {
// Withdrawal Incident
var gr = new GlideRecord(data.table);
gr.addQuery('sys_id', data.sys_id);
gr.query();
if(gr.next()){
gr.setValue('incident_state', 6);
gr.setValue('state', 6);
gr.setValue('resolved_by', gs.getUserID());
gr.setValue('resolved', gs.nowDateTime());
gr.update();
}
console.log('new sys_id :'+String(gr.sys_id));
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2018 11:08 PM
its working now, but the response took more time than usual by using the above code changes.
Do you have any idea?