- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:34 AM
Hi Team,
My requirement is to create all 3 types of change through background script. Please advice on this.
Thanks&Regards
Reena Kumari
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 05:47 AM
I got the issue, chg_model value was missing, try below:
Emergency:
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'emergency'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
chg.insert();
Standard:
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'standard'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='e55d0bfec343101035ae3f52c1d3ae49';
chg.insert();
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:54 AM
Follow below code:
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'normal'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.insert();
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 04:37 AM
Hi Raghav,
Your script is working fine for creating normal change but it's not creating emergency and standard change , if I change the type in script. Please advice.
Thanks
Reena Kumari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 04:52 AM
did you change the below line for standard and emergency:
chg.type = 'emergency'; // for emergency change
chg.type = 'standard'; // for standard change
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 05:22 AM
yes I have changed
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'standard'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.insert();
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'emergency'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.insert();