How to set assignment group in an inbound email action.

Hari1
Mega Sage

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();
1 ACCEPTED SOLUTION

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Hi Ankur,

It's working now. There was a space along with the assignment group. Now looks good. Thanks.

Glad that it helped

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ashutosh Munot1
Kilo Patron
Kilo Patron

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

Jaspal Singh
Mega Patron
Mega Patron

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();