activity.result in workflow run script activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 07:06 AM - edited 05-07-2024 07:21 AM
Hi All,
I have written the below script in the workflow run script activity. The change is closed and it is successful but it is not moving further from this activity. what could be the reason? Could you please assist?
var CR = new GlideRecord('change_request');
var CR = new GlideRecord('change_request');
CR.addQuery('parent', current.sys_id);
CR.query();
if (CR.next()) {
if (CR.state == '4') {
activity.result == 'Canceled';
} else if (CR.state == '3') {
if (CR.close_code == 'successful')
activity.result == 'Successful';
else
activity.result == 'Failed';
}
}
Thanks & Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 08:58 AM
Hi @Joshuu ,
This is more confusing. So when a RITM gets closed you need to create a change request. Is that your requirement?
If yes then you can update your code as below:
Also do share complete picture of your workflow to understand this better
var chg = new GlideRecord('change_request');
chg.initialize();
chg.short_description = current.short_description; //Similarly add other fields as required.
chg.insert();
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 09:10 AM
Hi @shloke04 ,
CHG is already getting created all working fine. But once the change is completed here checking the status of the change with the run script activity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 08:12 AM