Record producer fields mapping

DSV22
Tera Contributor

Hi team,

 

I have 3 fields in record producer to map with the 3 fields with incident form which I have done.using the script 

current.business_service = producer.field_name;

current.category= producer.field_name;

 

Category field is taking the backend choice value and the Business services field is not taking any value since it is a reference field in the incident form 

 

Can anyone please suggest how to achieve this task to populate the exact values which is selected while submitting the form.

 

Thanks

 

11 REPLIES 11

Hi @DSV22 ,

 

Apologies my bad, u need to use only 1 = sign in this line

 

current.business_service == gr.sys_id;

 

Can u try by removing the extra equals to line & check if it works

 

Thanks,

Danish

 

HI @Danish Bhairag2 

 

Still the same service field is not reflecting 

DSV22_2-1726057969822.png

 

 

Hi @DSV22 ,

 

Could u pls log producer.application_affected for me plz & let me know what is coming

Use this

gs.info("Business Service1"+producer.application_affected);

gs.info("Business Service2"+producer.application_affected.getDisplayValue());

 

Do this logs at the very 1st line before the actual code. Once executed can u then check logs & let me know what is the value coming for both

 

Thanks,

Danish

DSV22_0-1726064806962.pngDSV22_1-1726064817433.png

Hi @Danish Bhairag2 

Please check the logs

Hi @DSV22 ,

 

Assuming in ur service table u already have the application. Plz try below updated code:

 

var gr = new GlideRecord('cmdb_ci_service');

gr.addQuery('name',producer.application_affected.getDisplayValue());

gr.query();

if(gr.next()){

current.business_service = gr.sys_id; 

}

 

Thanks,

Danish