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.

Unable to send notification for survey to opened for when case state chagnes to close complete

Tahir Ahmed
Mega Sage

Hi

 

I have a requirement something like this:

**Hint: Business Rule will target “asmt_assessment_instance” table through GlideRecord**

*****Note: When the state on hr case will change to closed complete trigger condition will trigger a business rule, that business rule will trigger “assign.send_survey” OOTB event due to which notification will be send to the opened by of the hr case as a survey invitation.******

 

Survey trigger condition is: hr case state changes to closed complete

 

Details:

I had created a survey with the survey condition mentioned above, there was a business rule automatically attached to my survey condition when I saved the record.

 

TahirAhmed_0-1693237173274.png

 

 

this business has to trigger an event named assign.send_survey, then this event will send a notification to opened for user.

So I have decided to use this same business rule and added a script as mentioned in the above requirement with the following script:

 

function onAfter() {
    (new sn_assessment_core.AssessmentCreation()).conditionTrigger(current, '8d3cd34397b031104b28b3e6f053afee');
    var gr = new GlideRecord("asmt_assessment_instance");
    if (gr.get(current.table_sys_id)) {
        gs.eventQueue('assign.send_survey', current, current.opened_for);
    }
}
 
still when the survey is not sent to the opened for kindly help

 

1 ACCEPTED SOLUTION

Hi Susan
I have figured out what I was doing wrong with the help of my colleague. it was a minor mistake.

In the trigger condition I selected the HR Case table and when I was demo testing it I randomly chose open HR Case and changed its state to closed complete to check whether the email got sent to assignees or not, In all of this hurry I overlooked the key detail that was I had to test this with the cases that are made only on HR Case COE

View solution in original post

2 REPLIES 2

Susan Britt
Mega Sage
Mega Sage

Please attach a screenshot of your actual survey's Trigger Condition. 

  • Make sure you have a user populated that it needs to send to
  • Probability should be 100 or empty, if wanting sent each time
  • Verify the Repeat Interval value

Hi Susan
I have figured out what I was doing wrong with the help of my colleague. it was a minor mistake.

In the trigger condition I selected the HR Case table and when I was demo testing it I randomly chose open HR Case and changed its state to closed complete to check whether the email got sent to assignees or not, In all of this hurry I overlooked the key detail that was I had to test this with the cases that are made only on HR Case COE