Recalculating Assessment Data for Demand?

SandyL83
Tera Guru

Hello,

I have a requirement to recalculate the Assessment Data Results on Demands. 

Current Assessment Data looks like this:

SandyL83_0-1679065678365.png

 

 

 

On the Assessment Instance, the user can update the values:

SandyL83_1-1679065678330.png

 

 

 

I am looking to create  UI Action on the demand page to recalculate the assessment data.. any ideas?


THank you

1 ACCEPTED SOLUTION

Ok, so now try to determine whether the business rule is running or not - do you still have the logging line, and are you seeing anything in the logs?

art_jones_0-1680110006654.png

I edited 4 values so this gets logged when the business rule runs

art_jones_1-1680110075330.png

 

 

 

View solution in original post

24 REPLIES 24

Hi, If you are seeing the message but the scores don't change I imagine that the business rule portion isn't working correctly.  You can determine this by looking at the Assessment Results related list - the business rule should re-run the logic that calculates the results, so they should change if you edit the instance question values.

Example:

For example, if all the Risk question values (on the instance) are 9's:

art_jones_1-1679937496599.png

then the results should look something like this:

art_jones_2-1679937600539.png

and the score looks like this:

art_jones_5-1679938067628.png

 

If you change the question values (on the instance) to all 5's:

art_jones_3-1679937701441.png

then the results should also change (if the business rule is working):

art_jones_4-1679937753459.png

So if the UI action runs, it updates the score:

art_jones_6-1679938103859.png

 

 

 

The UI action uses the results, so if they don't change then the scores won't.  Can you take a screenshot of your business rule?

hi, thank you SO much for all this info: 

 

Yes, the message is being displayed. I am hoping i am just missing something small. 

 

here is my business rule:

SandyL83_0-1679939376147.png

(I have insert and update selected, I've tried with just Update checked and it doesn't work)

 

Here is the code- I have changed it because we have a custom business rule

SandyL83_1-1679939434451.png

Notice the script is different because during the setup of our Demand module, the business rule to populate the score was disabled and this one was created - So in my new business rule, I used that code.

 

 

(function executeRule(current, previous /*null when async*/) {

var assessmentUtil = new RSMAssessmentUtil();
assessmentUtil.populateScores(current);

})(current, previous);

 

Sorry - I mean to say the UI Action code is different because we have a custom business rule: 

function rerun(){
gsftSubmit(null, g_form.getFormElement(), 'rerun_metrics');
}
if (typeof window == 'undefined')
callScriptInclude();

function callScriptInclude() {
var assessmentUtil = new RSMAssessmentUtil();
assessmentUtil.populateScores(current);
gs.addInfoMessage('Demand Scores Recalculated');
action.setRedirectURL(current);
}

Hi, everything seems fine, although you only want the business rule to run on update (i.e. only when someone changes their question values). 

Try adding some logging like this:

art_jones_0-1679943863825.png

 

You should see a log entry for each question value updated, so you'll know if the rule actually ran.  Also, when you update a question value now, is the related result value being updated?

Hello! Thanks again. So I added the script to the business rule and I can't see anything in the logs.. so I did debugging and I do see this message:

 

Action script not found, rerun_metrics. That is the name of the business rule. 

Any ideas with this?

Also, none of the values are being updated (not in the Assessment Results or Assessment Data).

THank you again for all of your help

SandyL83_0-1680016146862.png