While importing using transform map, how to set value for String field having choice list?

prabhasgupte
Kilo Expert

I am importing some data using Import Set table and transform map. Data is being imported into cmdb_ci_computer table. This table have two fields (os and discovery_source) of type String, but both have choice list associated with them.

Now, when I create a field map for each of them, my source field is of type String (without choice list) and target field is of type String (with choice list). The Choice Action is set to "create".

When the transform happens, I get error message Invalid Table assignment to the Choice record.

If I set Choice Action to "ignore", I don't get this error, but it neither sets value. I must set the value there.

How can I get rid of this error?

1 ACCEPTED SOLUTION

prabhasgupte
Kilo Expert

Answering my own question, because I got hold of it and could figure out what was actually going wrong.



One encounters this error when you are trying to add those choice list from any scope other than "Global" scope. If you switch to "Global" scope and do the same thing (mentioned in question), you will not see that error message and even the choice list will have the desired value.


View solution in original post

6 REPLIES 6

Gurpreet07
Mega Sage

Hi Prabhas,



Keep the choice action as ignore otherwise transform map may create numerous choices in that field of the target table. You additionally need a transform script of onBefore transform script for this.


1. Check the run script checkbox on the transform map and then write your code in the script



if(source.field_name = "field_value" ){                         // field value is the string value coming from the source table              


        target.field_name   = "choice_value" ;           // this choice value should already be existing one in choice list of the target table's field


}



then you need to write above condition for all different string values coming in the source table


You need to follow the same procedure for other field as well.


Hi,



gurpreet But I really want my transform map to create those numerous choices in target field, if its not already there. I just want to get rid of that error message.


There seems to be some error with the service now. its seems like while creating a new choice value , its referencing a wrong table name for new choice value. You may need to create a hi ticket for this.


prabhasgupte
Kilo Expert

Answering my own question, because I got hold of it and could figure out what was actually going wrong.



One encounters this error when you are trying to add those choice list from any scope other than "Global" scope. If you switch to "Global" scope and do the same thing (mentioned in question), you will not see that error message and even the choice list will have the desired value.