Showing SCTASK numbers with an email

StewartF
Tera Expert

I'm working on revamping our email notifications, as users don't like them - they show irrelevant information, yet also don't show the right information.

We currently have 3 emails firing to the user when their request is submitted -:

1 - Request REQxxxxxxx has been opened on your behalf
2 - Your Request RITMxxxxxxx has been received
3 - Your request REQxxxxxxx has been approved

I can easily shrink these down to one email, and only have the approved email send when something actually needed approving, instead of when it's auto-approved.

However, I need to also amend the ones we get on the Service Desk - say if a user requests a new starter and kit, we get 11 emails for the individual tasks which is majorly overkill. We have a few steps for both setting up a new starter, and building kit, hence there are so many.

I want to cut this down to just ONE email - I want it to come through as a Request has been logged, providing the RITM number in the subject (easily done, that's fine), but also listing the individual task references in the email body. Links to go to the tasks would be a nicety too.

I've been looking at the mail scripts, and been trying to see if there is a post already on this, but been able to figure it out/find a previous question about it.


Anybody have any ideas how I could achieve this please?

17 REPLIES 17

The field that is relating task and RITM is request_item

Try the below script

var scTasks = new GlideRecord('sc_task');
scTasks.addQuery('request_item', current.sys_id);
scTasks.query();
while(scTasks.next()){
template.print("Task Number: " + scTask.getValue('number'));
}

Didn't work -:

find_real_file.png

Here's what I have for the notification - definitely on the Requested Item -:

find_real_file.png

 

Will the tasks be created by the time notification fires?

Well I can see the tasks in the queue almost immediately, but I think it all fires at the same time.

If there a way of getting the notification to fire after 1 minute, or less, at all?

See if  gs.sleep(1000); helps