- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 12:39 AM
Hi,
I have assigned the group name to a variable. I need to set the variable gp value to the assignment group field. This is a inbound email action. I am getting empty when i try to set the assignment group.
var str = "Name : ABC<br/>Volume Owner: Group Name<br/><br/>";
var regex1= /(.*)Volume Owner(:| )(.*)/i;
var ci1=regex1.exec(str);
var store1 = ci1[3];
var regex2 = store1.split("<br/>");
var sp = storeGroup.split(":");
var gp = sp[1];
var grinc = new GlideRecord('incident');
grinc.assignment_group.setDisplayValue(gp);
grinc.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 02:47 AM
Hi Hemanth,
So you are able to get group name properly i.e. Data Center
I could see the value with comma i.e. , Data Center
Did you try to print variable value?
var value = trimvalue.substring(0, trimvalue.indexOf("<br/>"))
gs.info('Group is: ' + value);
I ran this in scripts background and able to get group name
var str = "Name : ABC<br/>Volume Owner: Group Name<br/><br/>";
var regex1= /(.*)Volume Owner(:| )(.*)/i;
var ci1=regex1.exec(str);
var store1 = ci1[3];
var regex2 = store1.split("<br/>");
var sp = store1.split(":");
var trimvalue = sp.toString().trim();
var value = trimvalue.substring(0, trimvalue.indexOf("<br/>"));
gs.info('Group is->' + value);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 10:45 PM
Hi Ankur,
It's working now. There was a space along with the assignment group. Now looks good. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 11:05 PM
Glad that it helped
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 12:54 AM
HI,
Few things you should take a look at:
1) Put logs after var gp and check the value.
2) Reference qualifier on incident group field.
3) this groups type and roles.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 02:39 AM
Hi Hemanth,
Can you try something as below.
var str = "Name : ABC<br/>Volume Owner: Group Name<br/><br/>";
var regex1= /(.*)Volume Owner(:| )(.*)/i;
var ci1=regex1.exec(str);
var store1 = ci1[3];
var regex2 = store1.split("<br/>");
var sp = store1.split(":");
var trimvalue = sp.toString().trim();
var value = trimvalue.substring(0, trimvalue.indexOf("<br/>"))
var grinc = new GlideRecord('incident');
grinc.initialize();
grinc.assignment_group.setDisplayValue(value);
grinc.insert();