Record Producer script

lukejames1uk
Kilo Explorer

Hi there

I have a record producer form as one of our service catalogue items. I need to get some of the populated variable information into the title or short description. Does anybody know how to do this?

Regards

Luke

6 REPLIES 6

nikita_mironov
Kilo Guru

To access variables used in record producer I use syntax current.variables.[variable name] from a business rule. I think the same will work in "run script" activity in workflow which you can use to create new cmdb record using GlideRecord object. Then you might want to save the ci sys_id to scratchpad to use it in "create task" activity scripts to populate new change task Configuration Item field.

Example or "Run Script" Activity in workflow (I did NOT test it)
rec = new GlideRecord("cmdb_ci_server");
rec.initialize();
rec.name=current.variables.server_name;
workflow.scratchpad.ciSysid = rec.insert();

In later activities you will be able to reference to ci sys_id using
task.cmdb_ci = workflow.scratchpad.ciSysid;

More about ScratchPad: http://wiki.servicenow.com/index.php?title=Using_the_Workflow_Scratchpad


nikita_mironov
Kilo Guru

current.short_description = producer.var1 + ' '+producer.var2; // 🙂