Clearing a field when related field is cleared (same principle as user id & location) or (category & classification)

germc
Giga Expert

Hi guys,
One of our guys here has set up a new field on the incident form called 'Configuration item' where it links in the users asset info. The thing they are struggling with is how to get this field to blank out when the Caller is blanked out. I was looking at the script for the 'Location' field on the Incident form, as that does blank out like it should and then re-populate when a different Caller is added. I want this same result with the CI field as well. Can't figure it out though... I looked at the wiki and found info on Cascade Delete Rules (http://wiki.servicenow.com/?title=Reference_Fields) but tried that and it didnt work. Not sure if I am on the right track or not! Is a script needed or is there an attribute we can add to the dictionary?

10 REPLIES 10

Thank you.
The script for the Company Projection business rule is:
if (!current.caller_id.isNil() && current.company.isNil())
current.company = current.caller_id.company;

I have tried to create something similar on our dev system on the HR table and I called it 'Config field for email/SS'
This is what I tried to do:
if (!current.caller_id.isNil() && current.cmdb_ci.isNil())
current.cmdb_ci = current.caller_id.cmdb_ci;

whereas caller_id = the caller name and cmdb_ci = the config field that I want to populate on SS and email
I tested but it does not work.

I dont know if I am on the right track or not.


david_legrand
Kilo Sage

I don't know your instance but I quite sure the "cmdb_ci" isn't an OOB user field. Maybe the "u_cmdb_ci" is (because it could be a new field you added) 🙂

current.caller_id.cmdb_ci ==> current.caller_id.u_cmdb_ci

Best regards,


Apologies, no its not an OOB field.
It is a field that has been created by us.
It is called 'Configuration item' and the column name is cmdb_ci.
I have attached a printscreen with the field circled and the data shown.
Does it make a difference if it is not an OOB field?


david_legrand
Kilo Sage

It makes a difference but not on the incident form,
Recheck the line "current.caller_id.cmdb_ci ==> current.caller_id.u_cmdb_ci" (the bold part as i assumed you named the field like that).

To know that, just check the field on the caller form exactly as you did in the incident form 🙂


thank you very much,
I made the change and tested but the config field still does not populate when a Self service ticket comes in.
Apologies as it wasnt myself that created this field. When you say check the field on the caller form do you mean go into somebodys user record? I have attached a printscreen of where the config items are on somebodys user record.