copy a string value to a reference field

Snow Dev5
Tera Contributor

Hi SNOW Dev,

Is it possible to assign a string value to a reference field? For example,assignment group is a reference field, and I'd like to assign "Team Acme" (String) to an assignment group field like the below.

 

assignment_group = "Team Acme"

 

I tried it but didn't work. Thank you in advance.

1 ACCEPTED SOLUTION

Dhananjay Pawar
Kilo Sage

Hi,

Check below script.

 

var gr = new GlideRecord('incident');
gr.addQuery('number','INC0010111');
gr.query();
while(gr.next()){
var str_value=gr.description;
gs.print(str_value);
gr.assignment_group.setDisplayValue(str_value);
gr.update();
}

 

Result -

find_real_file.png

 

Note - Make sure your string value should be present in Group table.

 

Mark correct/helpful based on impact.

Thanks,

Dhananjay.

View solution in original post

18 REPLIES 18

MrMuhammad
Giga Sage

 if you are using business rule then try one of the below. 

current.setDisplayValue('assignment_group', 'Team Acme');

or

current.assignment_group = 'Team Acme';

 

Please mark this correct & helpful if it answered your question.

Thanks & Regards,
Sharjeel

 

Regards,
Muhammad

find_real_file.png

I tried both ways.

It looks like it doesn't work because the types are different. Thanks.

try adding Database group manually in the assignment group field and see if you can add that. 

I tried different ways and all working fine for me. 

find_real_file.png

find_real_file.png

Regards,
Muhammad

Snow Dev5
Tera Contributor

I tried both ways, but no luck. 

find_real_file.pngfind_real_file.png