Populate display name field using business rules

Bargavi
Mega Expert

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

14 REPLIES 14

anurag92
Kilo Sage

Can you try logging the value of current.field2?


No I am unable to log current.field2 as well.



No below script is working. Do I have to provide some condition?


Harish KM
Kilo Patron
Kilo Patron

What type is your field2? Reference?


Here is the example code which I tested


var display_field = current.assignment_group.getDisplayValue();


var x = "abc";


  current.description = x +'-'+display_field;


find_real_file.png


Regards
Harish

Both the fields are type string.