How to determine multi-row variable set has changed in a script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 10:08 AM
I have a multi-row variable set with 8 variables in it that is used on several catalog items. Once the item is ordered and the RITM is created, the person ordering the item may need to update one or more of the variables in the multi-row variable set.
For ease of reporting, I'm copying the values from the multi-row variable set to a custom table when the RITM is created using a "before insert" business rule on sc_req_item.
What I need to do is update my custom table when any of the values in the multi-row variable set are modified, but I can't figure out how to write the condition on the "Advanced" tab in the business rule. I've already discovered I can't use the filter conditions in the "When to run" tab for the variables since I don't get the option of "on change".
Is it possible to check the entire multi-row variable set for changes and not every variable in it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 12:08 PM
Hi, your post doesn't make your configuration clear but if your custom table\reference mrvs data is a direct 1 to 1 with the actual mrvs data then an after update BR on 'sc_multi_row_question_answer' should deliver a suitable result. Otherwise perhaps an after update BR on 'sc_req_item' that queries 'sc_multi_row_question_answer' for related records and then compares this data to your reference\custom table data using the same formatting that you previously used to generate the record(s).
Can you provide specific details of your configuration as any other solution will depend on details that are not available in your post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 01:59 PM
Hi Tony, you have some interesting suggestions that I would like to explore.
My custom table is a 1 to 1 relationship, 1 row in the MRVS = 1 row in the custom table. My goal is to create a script that will update the custom table when the MRVS on the RITM has been modified. I want to avoid running a script that updates every time the RITM is modified since any time someone adds a comment or makes any other change it is considered modified.
I did not know about the sc_multi_row_question_answer table. I took a look at it and noticed that the data from the MRVS is not always in the table. What triggers writing data to the table? It seems like using table for changes could be a good suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 03:21 PM
Tony - I think what you suggested may work. I can create an update BR on sc_multi_row_question_answer that updates the associated record on my custom table. However, to make it easier I need the row_id from the MRVS. Do you know how I can get the row_id in a script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 05:08 PM
Hi, I see no row id on 'sc_multi_row_question_answer' but the variable set records look to be grouped via the field 'row_index', with the 'set' with the lowest row_index showing first in the sc_req_item form view list - testing this quickly by manually updating row_id for a record set in a PDI.