- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 12:34 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 06:48 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 05:46 AM
Hi David,
That sounded good. Get the value then Set it.
I just tried that syntax but category won't come over from INC to KB
Maybe my var should NOT be the same name as the field.
Function submitDirect() {
var kb = new GlideRecord("kb_knowledge");
var category = current.getDisplayValue('category');
kb.kb_category.setDisplayValue(category);
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 05:54 AM
Add in a gs.log() to see what value the category variable is returning
gs.log('this is the category: ' + category);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 06:04 AM
The log returned this which is the category on the incident in the string field choice, but nothing was inserted into the kb_category field on the kb_knowledge form which has a reference field with that same label. The value for both fields is application_software
this is the category: Application Software
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 06:10 AM
Is the kb_category field a reference field? If so, is there a field in the table it is referencing with the name Application Software?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 06:14 AM