Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate original value of Assessment Instance Question?

SandyL83
Tera Guru

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..

SandyL83_0-1680789984677.png

 

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,

1 ACCEPTED SOLUTION

Bert_c1
Kilo Patron

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".

View solution in original post

10 REPLIES 10

Thanks.. I think the issue is that when the record on the asmt_assessment_instance_question is inserted, the "Value" is null. 

So if the rule runs as I have it setup above, the "original_value" will be null.

 

I want the oringinal_value to be populated once the assessment instance is submitted and the value field is populated with an actual value. 

I have tried multiple different ways to do this (in the condition of the BR, I have said where assessment instance state changes to Complete, etc), and nothing seems to work. 

Thanks again for all of your help!