Populate the Configuration Item assigned to the "Requested for" user as the CI in the Catalog Task

ReshmithaK
Tera Contributor

Hi All,

 

My requirement is to populate the communication device (the communication devices are stored in a ci_comm table) assigned to the "Requested for" user of the catalog item as the configuration item(Affected CI) in the catalog task that gets generated through a workflow.

 

I don't have any variable in the catalog item that captures the communication devices assigned to the requested for user. So, I cannot dot-walk to set the task.cmdb_ci value using current.variable.

Can you please help me in setting the configuration item of the catalog task with the communication device assigned to the "requested_for" user.

 

Note: "assigned_to" field in the Communication Devices(ci_comm) table should match with the "requested_for" variable user in the catalog item and populate the "asset_name" from the ci_comm table as the cmdb_ci item in the catalog task through workflow activity.

 

Thanks in advance.

1 ACCEPTED SOLUTION

SivaNagaM
Tera Expert

Please try to use the Business rule which is on table "sc_task" which is having condition's before- insert.

Please try the code and modify the code as per your requirement.

 

var sm = new GlideRecord('cmdb_ci');
sm.addQuery('assigned_to',current.request_item.requested_for);
sm.query();
if(sm.next()){
current.setDisplayValue('cmdb_ci',sm.name);
}

View solution in original post

1 REPLY 1

SivaNagaM
Tera Expert

Please try to use the Business rule which is on table "sc_task" which is having condition's before- insert.

Please try the code and modify the code as per your requirement.

 

var sm = new GlideRecord('cmdb_ci');
sm.addQuery('assigned_to',current.request_item.requested_for);
sm.query();
if(sm.next()){
current.setDisplayValue('cmdb_ci',sm.name);
}