Can the selectbox variable map to reference field in incident

DSV22
Tera Contributor

HI

 

I have choice variable (Application Affected) in my Record producer, and I need to map the field to Category and Service Fields in the Incident form 

The incident form Service should be reference field, and a user should be able to search for the application if reporting from the native view.

 

I have tried with script in RP

 

current.category = producer.application_affected.getDisplayValue();
current.subcategory = producer.issue_type.getDisplayValue();
current.cmdb_ci_service.setDisplayValue(producer.application_affected);
 

Is this possible can anyone help me to achieve this

1 REPLY 1

Brad Bowman
Kilo Patron

Try using the Map to field option on the variable first to map Application Affected to Service on the incident form.  Application Affected should be a reference variable.  If this must be a choice variable, set the value of each choice (not the label) to the sys_id of a record on the cmdb_ci_service table, then if it doesn't map due to the type mismatch, in your script you can use

current.cmdb_ci_serivce = producer.application_affected;

I'm not sure what you're trying to do with category and subcategory in the script.  You can just have 2 select box variables that map to these fields.