Business rule to take a choice list field value and populate a reference field

Jeff316
Kilo Guru

Hi All,

I'm using the oob business rule called "Incident Create Knowledge" to bring the "Category" from the Category string field (choice list) of the incident to the kb_category field on the Knowledge Article form which is a reference field.

So on the incident form Category field I have a choice value "hardware"

On the Knowledge Article form in the kb_category reference field I also have a value "hardware"

What is the syntax in the business rule to set category of incident with kb_category of knowledge article?

Ugh.

 

Thanks

 

1 ACCEPTED SOLUTION

hmm, i wonder if there is an issue with setDisplayValue because the field is translated. Not sure on that one, the below method will glide into the table and get the value to set instead:

Function submitDirect() {

var kb = new GlideRecord("kb_knowledge");
var category = current.getValue('category');

var gr = new GlideRecord('kb_category');
gr.addQuery('value', category);
gr.query();

if(gr.next()){
var catSysID = gr.getValue('sys_id');
 kb.kb_category = catSysID;
}

 kb.source = current.sys_id;
 kb.u_authoring_group = current.assignment_group;
 kb.author = current.resolved_by;
 kb.short_description = current.short_description;
 kb.text = current.close_notes;
 kb.description = current.description;	
 kb.insert();
}

View solution in original post

15 REPLIES 15

Great, glad you got it working. I think the translation on the field changes it's appearance on the client side but the server is still in the original language so the setDisplayValue method wasn't working because we were feeding in the display value in the wrong language.

 

Happy to help, i've found the community massively helpful in advancing my knowledge of Service Now so i would highly recommend dipping in and out and coming up with your own solutions to other peoples problems!