Getting value of a choice field in Business rule

sreevishnu
Tera Contributor

Hi,

I am facing some issues in getting the value of choice field in the business rule, I tried using the getValue() and getDisplayValue() in the current object but I am not getting the value in the logs.

I have one separate table and I am using the field in the table using dot walking in the list layout, suppose I have an inciednt table and I have a secondary table called xyz and xyz has a choice field called program, I am dot walking the field program to the incident form using the list layout and I am trying to insert the value into the table xyz from a business rule when the incident form is submitted, in the same incident form I have 3 more reference fields which are coming from the table xyz, but I am getting the values of those reference fields in the business rule and its saving properly, only for this choice field I am not getting the value in the business rule.

Thanks in advance 🙂

14 REPLIES 14

Harish KM
Kilo Patron
Kilo Patron

did u try the below?

var category = current.getValue('category');
Regards
Harish

sreevishnu
Tera Contributor

yes Harish, I have tried the getValue() and getDisplayValue(), both are returning null, I have tried to call it directly from the current object also like current.category, but it's returning an empty string.

can you share your script?

 

Regards
Harish

sreevishnu
Tera Contributor

function onBefore(current, previous){

var update_ext = new GlideRecord('u_task_ext');
update_ext.initialize();
update_ext.u_task = current.sys_id;
update_ext.u_io_country = current.u_task_ext.u_io_country;
update_ext.u_program = current.u_task_ext.u_program;
update_ext.u_project = current.u_task_ext.u_project;

update_ext.u_client = current.getValue('u_task_ext.u_client'));

current.u_task_ext = update_ext.insert();

}

this is trying to insert the values into table u_task_ext and u_client is a dot walking field from the u_task_ext table itself. i am getting the value of country, program and project, but not getting the choice value.

 

 

Regards

Sreevishnu