I want to add a record to a related list via script

jonw1
Mega Expert

I have a variable (referencing: cmdb_ci_computer) on a catalog item, and I would like to add the referenced computer to the "affected CIs" related list on the requested item record.   I don't know how to refer to the related list in my script.

Specific use case ... after the last task in the requested item workflow is completed, I want to make the entry to the appropriate related list on the RITM being completed.

 

Thanks!

12 REPLIES 12

Try to get the related_list_table_name from the list control of the related list. Right click related list header > Personalize/Configure List Control. Copy the value from the field 'Related list'.

jonw1
Mega Expert

Thank you.   That helps.   Now I just need to figure out the syntax for adding to (not overwriting) any existing entries on the list.

jonw1
Mega Expert

Yes, thank you.   I can work with that.

jonw1
Mega Expert

Actually, as I look closer, that script is not adding to existing, it's creating a new entry.