Display reference field value into string fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 02:23 PM
My script is not working:
var one = current.u_group.getDisplayValue();
var gr=new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id);
gr.query();
if(gr.next())
{
gr.u_kb_group=one;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 10:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 09:26 AM
D Kishore,
In your screenshots I see you referencing the "approval for" column, but that is for only task related tables, if I recall. The other issue would be that document_id is a sys_id, and works together with a table specification.
Instead, try adding a condition in your business rule where the "Source table" field is "kb_knowledge" (a string). If that condition matches, you can then proceed to query for the knowledge record in question to retrieve it's group.
Below is a screenshot of a quick proof of concept business rule (running on the Approval table):
Then, I would use a script like below:
(function executeRule(current, previous /*null when async*/) {
var getGroup = new GlideRecord('kb_knowledge');
getGroup.addQuery('sys_id',current.document_id);
getGroup.query();
if (getGroup.next()){
current.u_kb_group= getGroup.u_group.getDisplayValue();
}
})(current, previous);
I would be curious about the requirements, however. What exactly are you trying to accomplish by referencing the group in the approval record? There may be a less intrusive way to accomplish your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:43 AM
Hi Dylan,
First when i select Group in KB record, that Group name should be display in KB Approver u_kb_group filed .
as per your script you have taken Table:sysapprover_approvar is it works??
I means when we update/insert KB record then KB record Group name should be display in Approver record u_kb_group field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:51 AM
D Kishore,
The business rule I posted a screenshot is on the Approval table. That way, whenever an approval is added for a knowledge article, it will place the group name in the approval. In my example, I was making the assumption that the group field is specified before an approval record is inserted.
I did a couple tests, and my example worked, although of course you should conduct your own testing as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 11:00 AM
Hi Dylan,
here we are taking Group name before crate Approver in KB record
first we are filling KB record with short description, Group name , Category once we submit the form then after only Approvers will created.