How to add an asset in asset table using workflow task ?

ragz
Tera Expert

Hi ,

 

My requirement is once order the laptop  using Service catalog . Once Laptop has been received then one of the teams has to respond to the task . Then the Laptop details like serial no . model all will be added to Assets table and assigned to the requested user ? How to achieve this ?

 

Thanks in Advance .

1 ACCEPTED SOLUTION

Serial number would be a variable that you add to the Catalog Item, then only show it on the Catalog Task.  If you run this script to create the CI before this Catalog Task, you can run a similar one after the task to update the CI record with serial number and whatever other information was added in that task, or wait to run the script until after the Catalog Task, and serial number would be added to the CI/Asset record that is being created similar to name, department, etc in my example

ci.serial_number = current.variables.v_serial_number;  - or whatever your serial number variable is named.

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

Use a Run Script activity in the workflow, something like this - to create a CI, which then auto creates a corresponding Asset, or just create the Asset record if that's what you really want:

 

var ci = new GlideRecord('cmdb_ci_computer');
ci.initialize();
ci.name = current.variables.v_name;
ci.install_status = 4; // pending install
ci.operational_status = 2; // non-operational
ci.department = current.variables.v_department;
ci.owned_by = current.variables.v_owned_by;
ci.insert();

 

substituting whatever field names on the new record you want to populate with whatever variable names or static values. 

Hi BradBowman,

Thanks for your response . How can the serial number can given into the asset column from the team ? In detail the serial number comes after receiving the device .

Serial number would be a variable that you add to the Catalog Item, then only show it on the Catalog Task.  If you run this script to create the CI before this Catalog Task, you can run a similar one after the task to update the CI record with serial number and whatever other information was added in that task, or wait to run the script until after the Catalog Task, and serial number would be added to the CI/Asset record that is being created similar to name, department, etc in my example

ci.serial_number = current.variables.v_serial_number;  - or whatever your serial number variable is named.