Convert Standard Item to Matrix Child Item

2019-04-02 15:49发布

I have a scenario I'm a little stumped with, and hoping the Stack gurus can assist.

I have product ABC123.WHT (example) as a standard inventory item, with over 12 months of history/transactions etc... ABC123.WHT is a white product, and ABC123.BLK is of course black.

They were originally created as standard (non-matrix) items during implementation, but for various reasons I now want to have them as matrix items, ABC123 naturally as the parent, and ABC123.BLK & ABC123.WHT as the child items.

Now when looking at the item record information in the F12-Console, there are a number of fields my script has changed:

hasparent = 'T'                                // changed from 'F' to 'T'
parent = '1234'                                // internal id of the parent code
itemoptions = ['CUSTCOL_COLOUR']               // set the option array with the colour list id
matrixoptioncustitem_colour = '100'            // colour list id for WHITE
matrixoptioncustitem_colour_display = 'White'  // colour name
matrixtype = 'CHILD'

My script can successfully change these fields, and sort of links the new child to the parent (ie. in lists shows as ABC123 : ABC123.BLK) however, the child code does not show up in the parent code item record in the Matrix Items list.

In the child item, the subitem of field is populated, but not read-only like a true child item, and thus could be deleted by any user with item-edit permissions.

Additionally, true child items show the MATRIX-SUBITEM subheading next to the item name when displaying the item record, whereas the childed standard item does not. It also does not show the item options (such as colour) in the child record.

This process does work when moving a true child item from one parent to another, so I suspect there is perhaps a kind of hidden flag I need to set to truely activate the child-parent link.

To me this would be a far simpler and safer method for my scenario, rather than merging all the transactional history from one item id to another.

Anyone with the answer to this one?

1条回答
贼婆χ
2楼-- · 2019-04-02 16:21

The only way I was able to shift a child record from one parent to another, was by changing the parent field in the child record from the original parent itemid to the alternative parent item id.

To do this, the new parent code must be set up with the same itemoptions data as the old parent, or the link won't be created.

Hope this helps.

查看更多
登录 后发表回答