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

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

Since its a reference field you are importing with the name of the Stockroom can you try leaving the field

Referenced value field name empty once & then run the load.

MrMuhammad
Giga Sage

Hi, 

Can you please try using name in Reference value field name instead of stockroom?

Please mark this Correct & Helpful if it answered your question.

 

Regards,
Muhammad

Kunal Varkhede
Tera Guru

Hi,

 

Use OnBefore Transform map script to do your task-

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

target.stockroom = source.stockroomName; //replace back end name stockroom for target table and souce table(staging table)

})(source, map, log, target);

find_real_file.png

 

Please Mark correct/helpful answer if it help you in any way

Thanks,

Kunal

 

Anirban Roy
Mega Guru

Hi,

In your transform map choice action, you have kept the type as 'create'. For a drop down or a reference fields, keeping 'choice action' as 'create' forces the data to be inserted forcefully into the reference table.

Thus, in the first operation, a stockroom record gets created with the string name from the source. You may check whether the stockroom table has a new record with the name from the source/ staging table. 

In second case, the record from source/staging table finds a match in the stockroom table(created in previous step) and thus successfully creates the alm_hardware table with the correct stockroom field value.

 

Correct practice should be to load the dependent data first and then the actual data.

Regards,

Anirban