How to trigger survey notification after x days of RITM closing?

Abhi33
Tera Expert

Hi All,

I have created a Survey which is going to be triggered when the RITM is closed.

I have create a notification to send this survey link to the User.

How can this notification be sent to the user after x days of RITM closure.

Regards,

Abhi

1 ACCEPTED SOLUTION

Hi,

As per your question you want email to be sent x days after RITM is closed

Then your BR, event, notification should be on RITM table

Regards
Ankur

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

View solution in original post

17 REPLIES 17

Hi Pranesh,

I have created a notification separately, I want to trigger that notification after 2 days. how can I achieve that I am not aware of these scheduled jobs and events, can you please provide a sample code to look into, the links that you provided are stating about what to do but can you please provide me a sample code for better understanding, if possible.

Regards,

Abhi

var ps = 7; //days
	var pn = parseInt(ps);
	var queryTime = new GlideDateTime();
	queryTime.addDaysUTC(-pn);

	if (pn > 0) {
		var gr = new GlideRecord('incident');
		gr.addQuery('incident_state', IncidentState.RESOLVED);
		if (gs.getProperty('com.snc.incident.autoclose.basedon.resolved_at', 'false') === 'true') {
			gr.addQuery('resolved_at', '<', queryTime);
		}
		else {
			gr.addQuery('sys_updated_on', '<', queryTime);
		}
		if (pm.isActive('com.snc.incident.mim')) {
			var mim = gr.addNullQuery('major_incident_state');
			mim.addOrCondition('major_incident_state', '!=', new sn_major_inc_mgmt.MajorIncidentTriggerRulesSNC().MAJOR_INCIDENT_STATE.ACCEPTED);
		}
		gr.query();
		while(gr.next()) {
			var assess = (new SNC.AssessmentCreation()).createAssessments('sys id of survey');

		}
	}

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Best way is to use flow with no script.

Example:

1) Flow Triggers when RITM is created

2) Then use Wait for Duration logic and specify hours

1 day = 24 hours

x days = 24*x hours

3) then use Send Email Action and send the email

Regards
Ankur

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