Is there a way to auto-send stakeholders assessments for Demand?

Laurie Marlowe1
Kilo Sage

Hello,

Is there a way when a Demand record moves to the Screening state, to automatically send the assessment to the Stakeholders?   The wiki is indicating for one assessable record, I must go to the Assessments->Assessable Records and individually assign the assessment to each person.   OR could this be accomplished with a Scheduled Job and a filter?

Please and thank you in advance!

Laurie

1 ACCEPTED SOLUTION

Laurie Marlowe1
Kilo Sage

I figured it out!   I had to define the filter for the Metric Category!



Assessments->Types->Demand



Click on each of the Metric Categories on the Metric Categories tab.



Add a Filter to each Metric Category.



Capture.JPG


Then, when you move a Demand record from Submit to Screen, it will generate the assessment.   It does NOT generate an email notification that an assessment is ready.   You need to create that functionality.



Thanks all!



Laurie


View solution in original post

7 REPLIES 7

I was having this exact same issue! I even logged a ticket on HI.



When I came back to work on Monday, it started working again, so I was never able to understand why it was not working in the first place.


The technician said he didn't do anything and I wasn't aware of anything I did either.



I'll go through some things I did in the hope that it might just help.



Added gs.addInfoMessage on lines 22 and 26 to see if there were any error codes.



Business Rule Create OnDemand Assessment



gs.addInfoMessage('Creating Surveys');


var gr = new GlideRecord('dmn_m2m_demand_stakeholder');


var encodedQuery = "demand=" + current.sys_id + "^stakeholder.assessment=yes";


gr.addEncodedQuery(encodedQuery);


gr.query();


var userIds = "";


while (gr.next()) {


  if (!JSUtil.nil(userIds))


  userIds += ",";


  userIds += gr.stakeholder.user.sys_id;


}



if (!JSUtil.nil(userIds)) {


  gs.addInfoMessage('userIds:' + userIds);


  //create assessments for the list of users


  var val = (new SNC.AssessmentCreation()).createAssessments('0556fa9a8f12110040f82ab2f0f923f8', current.sys_id, userIds, false, "");


  gs.addInfoMessage('Assessment:' + val);


} else {


  //make sure to generate the ondemand assessments for the case where there are no stakeholders


  var val = (new SNC.AssessmentCreation()).createAssessments('0556fa9a8f12110040f82ab2f0f923f8',current.sys_id, gs.getUser().getRecord().getValue("sys_id"), false, "");


  gs.addInfoMessage('Assessment:' + val);


}



When it works, it should look like this:


working.PNG


When it wasn't, it looked like this:


Step 6.PNG


Other things I did:


  • Import all Assessments from an OOB instance (Risk, ROI, Cost, Size, Strategic Alignment)
  • Ensure I had Stakeholders with 'Assessment Recipient' set to true for the given portfolio (this shouldn't matter though)
  • Open Assessment Metric Type 'Demand' via Assessments > Metric Definition > Types and check it is correctly configured
    • Click 'Generate Assessable Records' to test if it is working


I wish I could be of more help!



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Laurie Marlowe1
Kilo Sage

Hi Paul,



This is maddening!   I added the gs.infoMessage to the business rule, and sure enough, the assessment value returns ",4,"!!!



One thing I did do, was remove the OOB Assessments.   I'm going to try importing them to see if that works.   I also opened a HI ticket, as the emails aren't generating in my developer instance either, using OOB demo data.



Is it necessary to click "Generate Assessable Records" each time a new demand comes in?   It shows assessable records for the Metric Definition.



Thanks!



Laurie


Laurie Marlowe1
Kilo Sage

I figured it out!   I had to define the filter for the Metric Category!



Assessments->Types->Demand



Click on each of the Metric Categories on the Metric Categories tab.



Add a Filter to each Metric Category.



Capture.JPG


Then, when you move a Demand record from Submit to Screen, it will generate the assessment.   It does NOT generate an email notification that an assessment is ready.   You need to create that functionality.



Thanks all!



Laurie