Changing the type of existing catalog item variable

Daisy3
Tera Guru

Hi,

I have a catalog item with an existing variable of type Single Line Text, which needs to be changed to a Reference type.

Instead of changing its type directly, I have created a new variable of type Reference and deactivated the existing variable of Single Line Text. Is this the correct approach?

Because, the RITMs created before the above-mentioned change, still shows the deactivated single line text variable and not the new variable with reference type. Is this expected and appropriate?

Is there a way to have the new reference variable displayed on the older RITMs, and some way to populate the info from the single line text to the reference variable for the older RITMs for consistency?

 

Or should I have changed the type of the variable directly instead of creating a new one. In this case, how should I preserve the previous value (single line text) to finally script it to reference value.

1 ACCEPTED SOLUTION

CezaryBasta
Tera Guru

You could try getting the new value to display on older RITMs, but first, you have to understand how the variables are connected to the RITMs. 

There is a separate table - sc_item_option_mtom. It holds a reference to the RITM and a reference to the sc_item_option record. The sc_item_option record holds a reference to the variable and its value.

So if you wanted to change old variables to the new one you'd have to:

  1. Find all value/variable pairs on the sc_item_option table
  2. Confirm that the value exists for your new reference variable
  3. Update the value on the sc_item_option table to the sys_id of the referenced record
  4. Update the item_option_new field to the new reference variable

I think this should be enough to update historica records.

Updating the variables on the catalog item will only affect new RITMs. Because the old ones are saved in a different table.

Creating a new variable is OK - changing the type used to create a lot of problems in previous releases, haven't tried that for a while.

--
See more of my content here.

View solution in original post

2 REPLIES 2

CezaryBasta
Tera Guru

You could try getting the new value to display on older RITMs, but first, you have to understand how the variables are connected to the RITMs. 

There is a separate table - sc_item_option_mtom. It holds a reference to the RITM and a reference to the sc_item_option record. The sc_item_option record holds a reference to the variable and its value.

So if you wanted to change old variables to the new one you'd have to:

  1. Find all value/variable pairs on the sc_item_option table
  2. Confirm that the value exists for your new reference variable
  3. Update the value on the sc_item_option table to the sys_id of the referenced record
  4. Update the item_option_new field to the new reference variable

I think this should be enough to update historica records.

Updating the variables on the catalog item will only affect new RITMs. Because the old ones are saved in a different table.

Creating a new variable is OK - changing the type used to create a lot of problems in previous releases, haven't tried that for a while.

--
See more of my content here.

Hi @CezaryBasta ,

Thanks for the above.

Yeah, I am aware of the sc_item_option/sc_item_option_mtom tables and can have the values updated if I just change the type of the variable directly.

Yet I was looking at having new variable created and explore the options around it. If you have any idea on this, please share. Thank you!