Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to update reference field through data import

kBahu
Tera Expert

I am trying to import data in Hardware [alm_hardware] table. There is one field on the form called 'stockroom' (referenced from alm_stockroom). I am not able to update this field. Any suggestions as in why it is happening would be great. I am importing data from excel and in import set the data is coming correctly in the source field.

As this is a reference field, tried to get the sys_id from the referenced table by using onBefore script but still it is not updating.

One strange behaviour observed though that when i try to upload same data again this field value is getting updated. But i want it to update at the first attempt.

find_real_file.png

1 ACCEPTED SOLUTION

kBahu
Tera Expert

I am able to update the stockroom field. Making asset state to In use and then updating the stockroom value from onBefore script helped.

find_real_file.png

Also , updated choice action to 'ignore' and referenced field value to 'name'

find_real_file.png

View solution in original post

6 REPLIES 6

klf1123
Kilo Sage

I do this exact upload, State field must be updated with "In Stock" and then the stockrooms need to be already created in your table. Just upload with a "stockroom name" already created. If you are not using actual stockrooms from the table then I wouldn't use it in the upload. But to put it In Stock you have to reference a Stockroom. Then I use choice action reject since I am picking from my stockroom reference table. 

kBahu
Tera Expert

I am able to update the stockroom field. Making asset state to In use and then updating the stockroom value from onBefore script helped.

find_real_file.png

Also , updated choice action to 'ignore' and referenced field value to 'name'

find_real_file.png