Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Record Producer Mapping

tomaslindev
Mega Guru

Hello everyone,
I have created a record producer in which I want to map several variables so that they are reflected in the fields of my created Change.
The problem is that I want the "CAB required" field to be checked in the default Change and that the cmbd_ci field reflects the same value as the "business_service" variable and completing the Assignment group field associated with the "business service" field.
This is the associated script that I have modified several times without success, any ideas.
Greetings and thanks in advance.

current.requested_by = gs.getUserID();
current.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
current.business_service = business_service;  // Application
current.cmdb_ci = business_service; // Configuration item
current.short_description = short_description;  // Summary
current.description = description;  // Description
current.justification = justification;  // Justification
current.implementation_plan = implementation_plan;  // Implementation plan
current.risk_impact_analysis = risk_impact_analysis;  // Risk and impact analysis
current.backout_plan = backout_plan;  // Backout plan
current.test_plan = test_plan;  // Test plan
curren.cab_required= true; // CAB required
current.start_date = start_date;  // Planned start date
current.end_date = end_date;  // Planned end date
1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@tomaslindev Assuming you are triggering this script from record producer script field and you have variables like description, justification etc. on the variable list on record producer.

 

current.requested_by = gs.getUserID();
current.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
current.business_service = producer.business_service;  // Application
current.cmdb_ci = producer.business_service; // Configuration item
current.short_description = producer.short_description;  // Summary
current.description = producer.description;  // Description
current.justification = producer.justification;  // Justification
current.implementation_plan = producer.implementation_plan;  // Implementation plan
current.risk_impact_analysis = producer.risk_impact_analysis;  // Risk and impact analysis
current.backout_plan = producer.backout_plan;  // Backout plan
current.test_plan = producer.test_plan;  // Test plan
curren.cab_required= true; // CAB required
current.start_date = producer.start_date;  // Planned start date
current.end_date = producer.end_date;  // Planned end date

Hope this helps.

View solution in original post

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@tomaslindev Assuming you are triggering this script from record producer script field and you have variables like description, justification etc. on the variable list on record producer.

 

current.requested_by = gs.getUserID();
current.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
current.business_service = producer.business_service;  // Application
current.cmdb_ci = producer.business_service; // Configuration item
current.short_description = producer.short_description;  // Summary
current.description = producer.description;  // Description
current.justification = producer.justification;  // Justification
current.implementation_plan = producer.implementation_plan;  // Implementation plan
current.risk_impact_analysis = producer.risk_impact_analysis;  // Risk and impact analysis
current.backout_plan = producer.backout_plan;  // Backout plan
current.test_plan = producer.test_plan;  // Test plan
curren.cab_required= true; // CAB required
current.start_date = producer.start_date;  // Planned start date
current.end_date = producer.end_date;  // Planned end date

Hope this helps.

Thank you very much for your help @Sandeep Rajput,

It works perfectly.
Regards