Create an RITM when Idea is accepted. Catalog item is hidden in the Employee Center.

Vaishnavi35
Tera Guru

Hi,

 

I have built a catalog item with its workflow. Its hidden in Employee Center for users to submit.

When an Idea is accepted , I want the RITM to be created with the Idea values that were submitted. Mapping the values basically. I want the Demand Number also on the RITM form. 

Demand Number field exists on the Idea form.

 

If anyone can help me with the BR?

Idea - Label and Name 

Vaishnavi35_0-1717694041366.png

 

RITM - Question & Name -

Vaishnavi35_1-1717691927797.png

Idea values have to map to the ritm variables.

 

I have an existing BR that creates a Demand when Idea is accepted.

When- before condition ; On "Update"

 

 

var demandTable = "dmn_demand";
if(GlidePluginManager.isActive('com.snc.project_management_v3')){
	demandTable = SNC.PPMConfig.getDemandTable(current.getTableName());
}

var demand = new GlideRecord(demandTable);
demand.setValue("description", current.description);

demand.setValue("requested_by", current.u_required_completion_date_if_any);//requested_by


demand.setValue("portfolio", current.u_global_process_shared_services_area);
demand.setValue("portfolio", current.portfolio);
demand.setValue("primary_program",current.u_program);
demand.setValue("priority", current.priority);

demand.setValue("short_description", current.short_description);
demand.setValue("type", "project");
demand.setValue("submitter", current.submitter);
demand.setValue("parent", current.sys_id);
demand.setValue("idea", current.sys_id);
var dmnId = demand.insert();
demand.get(dmnId);
current.demand = dmnId;
current.stage = 'demand';
GlideSysAttachment.copy('idea', current.sys_id, 'dmn_demand', demand.sys_id);
var link = ' <a href ="/' + demandTable + '.do?sysparm_query=number%3D' + demand.getValue('number') + '">'+ demand.getValue('number') +'</a>';
var message = gs.getMessage("Demand {0} has been created");
message = message.replace("{0}", link);

gs.addInfoMessage(message);

 

 

 

When Idea is accepted Demand and RITM should be created. But in RITM , Demand Number should also be populated.

Thanks,

Vaishnavi 

11 REPLIES 11

Hi Sasanka,

 

The RITM is not created 😞

Vaishnavi35_0-1718020445690.png

When I clicked on "Accept" button, Demand was created. RITM was also created

Also, received the error mentioned in the screenshot.

 

But RITM was created without any details or variable section.

Vaishnavi35_1-1718020624367.png

var ritmGr = new GlideRecord('sc_req_item');
ritmGr.initialize();
ritmGr.cat_item = '389e052687e20e909e70c91acebb351f'; // Replace with your catalog item sys_id
ritmGr.u_project_name = current.short_description;
ritmGr.u_project_description = current.description;
ritmGr.u_cost_center_c = current.u_cost_center; // Update this field if necessary
ritmGr.u_portfolio_c = current.portfolio;
ritmGr.u_program_c = current.u_program;
ritmGr.u_requested_for= current.u_requested_for;
ritmGr.u_manager = current.u_requested_for.manager;
ritmGr.u_request_made_by = current.submitter;

// Map Idea values to RITM variables
//ritmGr.variables.your_variable_1 = current.idea_field_1; // Replace with actual field mappings
//ritmGr.variables.your_variable_2 = current.idea_field_2; //
// Include Demand Number on RITM
ritmGr.variables.udemand_number = current.demand.number;

var ritmId = ritmGr.insert();

 

Thanks,

Vaishnavi

 

I have two Idea forms. Only when one of the form is submitted it should create an RITM. 

Right now, its creating for both forms. which I do not want.

 

I think creating a new BR should work. I can add a condition there? 

Or include in the code? 

 

 

REQ or Request number is not updated in the RITM record as well.

Vaishnavi35_0-1718022651613.png

 

Hey @Vaishnavi35 ,

Looks like this needs further investigation. Can we connect over a call to discuss this sometime? I might be able to help. 

Let me know what date/time works for you.

Hi @SasankaV ,

 

I have created a new BR where I have added a condition so that it creates only for one of the record producers not the other one.

 

Vaishnavi35_0-1718125491916.png

 

This part is working. 

But the variable section is not populated nor the Request(REQ) number.

 

Thanks,

Vaishnavi