- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 07:06 AM
Hello,
I have updated our Assessments to that the asmt_assessment_instance_question value can be updated.
I am looking to store the original value that was present when the assessment was submitted.
I thought I had it working yesterday, then we cloned down our instance and my business rule was lost. Now I redid it and it's not working. here is the business rule I am trying to use..
Here is the code:
(function executeRule(current, previous /*null when async*/) {
current.original_value = previous.value;
})(current, previous);
What am I missing?
there is a column titled "original_value", and the field the user is able to update is "value"...
Any ideas?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 07:55 AM
Hi,
It appears that your business rule runs "After" and there is no "current.update();" (which is to be avoided in an After BR). Set your BR to run "Before".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 07:55 AM
Hi,
It appears that your business rule runs "After" and there is no "current.update();" (which is to be avoided in an After BR). Set your BR to run "Before".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 08:26 AM
Hi, thanks for your response.
I updated it to "Before", and then here is my updated script: it still doesn't seem to be working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 08:53 AM
got it to work - thanks for the help. it actually works on After.
THank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 09:40 AM
Actually @Bert_c1 - so here is what happened. When I have it set to "After" and Insert and Update are selected, this code works.. but then I realized the Original Value was being updated whenever Value was updated. I want the Original Value not to change when Value is changed. So at this point, I've tried setting it to "Before" and "Insert" and "After and "Insert" and it's not working. THe only time I can even get the original value to populate is when both Insert and Update are selected. Do you have any idea why this would be happening? THanks!