- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 01:57 PM - edited 08-07-2023 02:02 PM
I have a record producer that has a catalog UI policy in place. Here is an example of how it works:
If someone selects a type such as 'Employee' (which is part of a selection list) for Variable 1 'Type'
Then Variable 2 'Employee Request' appears with its own set of selections (such as, add an employee or deactivate an employee)
If someone selects a type such as Contractor (which is part of a selection list) for Variable 1 'Type'
Then Variable 2 'Contractor Request' appears with its own set of selections (such as, add a contractor or deactivate a contractor)
Eventually, the 'Contractor' type and 'Contractor Request' variables were deactivated but there were existing records that used that selection, so I had to create a background script to update existing records to point to the Employee type in Variable 1 and Employee Request in Variable 2 since the Contractor variables have been deactivated but for some reason, I'm unable to update Variable 2. Not only will it not update, but the field won't even appear on the target record.
This is the background script I put together, which works for the most part:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 05:12 AM
You need to make sure that an entry for the generated record-variable combo exists in table question_answer. If at the time of submitting the record producer Employee Request was not part of the Record Producer, such an entry has not been generated and simply running
user_record.variables.request = ...
will not generate it.
I mean my guess is that the update is not happening (and the variable is not showing) because it does not exist as a record.
But - as said above - it is easy to check this, just see if the required record in question_answer exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 01:19 PM
This was mostly great, because it added the missing variable that I needed to the table, but I still ran into a few issues. I copied the code verbatim into my background script and after running the script, it ended up duplicating my requests, so now I have (2) 12345's. I was able to get around this without a background script and just manually inserting a new record to the question_answer table. Thank you!