Custom assessment types and notifications

Beth Clingenpee
Tera Guru

Our demand group is using some assessment types they created to have more control over the questions that are asked when assessing different demands. These are not triggered based on actions within the demand but are sent manually from the assessment type record and assigned to specific users.

When the assessment is sent an assessment instance is created in the 'ready to take' state; the user receives an email notification with a link to the assessment that opens on the portal or within the platform, depending on their permissions and if they are logged in already.

The assessment can also be found by going to the 'My assessments and surveys' module.

The email they receive does not have any information about the record that is being assessed, so they are not aware of what the assessment is for until they open the assessment.

The assessment they open contains the name of the demand (but not the number) to which it is related but does not contain a link to the demand.

We have been asked to include a link to the assessable record in the email; however, I have been unable to get a link to successfully render. 

When a manually assigned assessment is sent there is not a TriggerID created on the assessment instance. I have been unsuccessful in finding how the assessment is linked back to the demand at all. The related list on the demand labeled 'Assessment Instances' only contains the OOB assessments that are triggered - which are not being used in our case.

Any suggestions on how to get this to work? SN support states that it is working as designed to not have a TriggerID and Trigger table related to the assessment instances when they are manually assigned.

 

Thank you!

 

3 REPLIES 3

GlideFather
Tera Patron

Hi @Beth Clingenpee,

 

I have been working on assessments the last month a lot and one of them was for demands as well!

 

Not having the demand number or closer details in the Assessment & surveys is quite unfortunate, imagine person having more assessments to take... 

 

Regarding the link to survey, what notification do you use for it? What table is it and how do you trigger it (condition or event)?

 

 

 

_____
Answers generated by GlideFather. Check for accuracy.

There is an OOB notification that is sent when an assessment is assigned - "Assessment Notification for Demand"; it is sent on conditions. This is on the asmt_assessment_instance table. 

 

In the "What it will contain" section, there are fields selected that are intended to provide a link to the demand record - it is looking at current.trigger_id, but that is not available on the user created assessment types.

@Beth Clingenpee in that notifications, there's mail script calling a script include:

 

<mail_script>
var link = new AssessmentUtils().getAssessmentInstanceURL(current.sys_id);
var url =  '<a href="' + link + '">' + 'Click here to take your assessment' + '</a>';
template.print(url);
</mail_script>

 

function getAssessmentInstanceURL() in the AssessmentUtils() script include:

// Survey Instance Table URL
    getAssessmentInstanceURL: function( /* String */ instance) {
        var gr = new GlideRecord("asmt_assessment_instance");
        var type = '';
        if (gr.get(instance)) {
            var asmtRec = new GlideRecord("asmt_metric_type");
            asmtRec.addQuery("sys_id", gr.getValue("metric_type"));
            asmtRec.query();
            if (asmtRec.next())
                type = asmtRec.getValue("sys_id");
        }
        var instanceURL = gs.getProperty("glide.servlet.uri");
        var overrideURL = gs.getProperty("glide.email.override.url");
        var url = "";
        if (this.redirectToPortal() == 'true') {
            if (asmtRec.allow_public)
                url = instanceURL + this.defaultServicePortal + '?id=public_survey&instance_id=' + instance;
            else
                url = instanceURL + this.defaultServicePortal + '?id=take_survey&instance_id=' + instance;
        } else {
            if (overrideURL)
                instanceURL = overrideURL;
            else
                instanceURL = instanceURL + "nav_to.do";

            url = instanceURL + '?uri=%2Fassessment_take2.do%3Fsysparm_assessable_type=' + type + '%26sysparm_assessable_sysid=' + instance;
        }

        return url;
    },

 

Lines 940-969 here:

https://yourinstance.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=ca4033c1d7110100fceaa6859e610326

 

That shall be investigated what it returns or how that works..

_____
Answers generated by GlideFather. Check for accuracy.