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.

Set survey to trigger every quarter

kim-lindgren
Kilo Sage

I have a survey I want to trigger every quarter for members of a particular group.

 

On the related list of my Survey Definition [asmt_metric_type], I can add trigger conditions, however these seem to require specific events to trigger.

 

On the Survey Definition record itself, there is the Schedule Period field, but this does not allow anything between monthly and yearly.

 

What is the solution here?

 

 

Regards,

Kim

1 ACCEPTED SOLUTION

kim-lindgren
Kilo Sage

The problem is, I did not read the docs carefully enough and I did not realize there is a difference between assessments and surveys.

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

 

It says that the second parameter is ONLY for use with assessments. My "assessment" is actually a survey, so the second parameter should be left blank. Thus in my scheduled script:

 

triggerSurvey();

function triggerSurvey() {
    try {
        var gr = new GlideRecord("sys_user_grmember");
        gr.addQuery("group", "2ccabcccaf3d6a10e8f667caa6274980"); //Group SysID
        gr.query();
        while (gr.next()) {
            new SNC.AssessmentCreation().createAssessments('37b85f99af99ba1056b7a2c651274978' */My survey definition*/, '', gr.user);
        }

    } catch (ex) {
        gs.info(ex);
    }
}

 

Works like a charm.

View solution in original post

12 REPLIES 12

@kim-lindgren 

the 2nd parameter means the record against which Assessment should be raised.

seems the docs are confusing.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sorry for the drawn-out thread, but what is this record "against which Assessment should be raised"? Is it simply the record from which to retrieve the user for a particular Assessment Instance?

 

In any case I don't know how to solve this, may end up having to raise a support ticket. Tried solving the errors I posted above through this Support KB but to no avail.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0961711

kim-lindgren
Kilo Sage

The problem is, I did not read the docs carefully enough and I did not realize there is a difference between assessments and surveys.

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

 

It says that the second parameter is ONLY for use with assessments. My "assessment" is actually a survey, so the second parameter should be left blank. Thus in my scheduled script:

 

triggerSurvey();

function triggerSurvey() {
    try {
        var gr = new GlideRecord("sys_user_grmember");
        gr.addQuery("group", "2ccabcccaf3d6a10e8f667caa6274980"); //Group SysID
        gr.query();
        while (gr.next()) {
            new SNC.AssessmentCreation().createAssessments('37b85f99af99ba1056b7a2c651274978' */My survey definition*/, '', gr.user);
        }

    } catch (ex) {
        gs.info(ex);
    }
}

 

Works like a charm.