Is it possible to update the cmdb_ci field upon submission of the record producer form?

scottn
Mega Expert

We have a form where we need to update the cmdb_ci field based on what the user selected on their form, but only once they submit the form. Is this possible, or must the cmdb_ci field be updated on the form itself by the user? Ideally, once the user clicks submit, the cmdb_ci field would be updated in the background based on what they entered on the form.

Thanks for any help you can offer!

Scott

5 REPLIES 5

Abhinandan Pati
Giga Guru

Hi Scott,



Yes it is possible. You can use 'Script' block of record producer to perform this operation. Use 'producer' object to get the value on the form & assign it to cmdb_ci field.



BTW record producer is on which table?



Thanks,


Abhinandan


Hi Abhinandan,



The record producer is tied to our incident table.



At this point, I'd love to get something - anything - to appear in the cmdb_ci field. I've tried putting in several things in the script section but can't seem to get the format to take. Here is what I have tried:



current.cmdb_ci = 'test';



and



producer.cmdb_ci = 'test';



Are either of those correct, or am I doing something wrong entirely?



Thanks!



Scott


The script current.cmdb_ci is right.


But right hand side to equal sign is not right


cmdb_ci field on incident table is a reference field, so you have to give a sys_id



please write the below code, assuming the field name on the form where the user enters instance is cmdb_ci (or instance)


current.cmdb_ci = producer.cmdb_ci;


You will want to use the first one (current.cmdb_ci = 'sys_id'), but you will need to assign the sys_id of the cmdb item you want to attach to the new incident record.   You may have to do a GlideRecord query to get the sys_id of the record you want, unless it is a static value or the user is choosing a CI in a reference field on the record producer form.   If you need help generating that query just post what criteria you are using for choosing the CI.



-Steve