Populate display name field using business rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 10:37 PM
Hi,
I am trying to populate field_1 with the value "abc field_2" using business rule.
I have tried couple of Before business rule scripts, none of them are working
1. used concatenation
var field_2 = current.u_field_2;
var x = "abc";
var sum = x +' '+field_2;
current.field_1= sum;
2.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord(table_name);
gr.query();
var field_2 = current.u_field_2;
while(gr.next())
{
current.field_1= 'abc' + current.field_2 + ' ';
}
})(current, previous);
can anyone point me in right direction, please.
-Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 10:44 PM
Can you try logging the value of current.field2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 05:36 AM
No I am unable to log current.field2 as well.
No below script is working. Do I have to provide some condition?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 10:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 05:22 AM
Both the fields are type string.