Email notification empty values

rlehmann
Kilo Sage

Looking for some assistance on an issue with blank emails.

Created 2 new tables as extensions of the Task table and they are CCR (a specific type of request) and CCT (any tasks associated with that request).

The requirement is to send an email notification to the CCR requester, 3 days after a specific CCT task state changes to Pending.

A client script has been configured to set a reminder date field on that CCT, whenever the state changes to Pending.

Created a scheduled job to run periodically (for testing purposes currently set to every 10 min) and when the conditions within the script are met, it triggers an event and sets a reminder sent flag on the CCT.

The event runs on the CCR table and is being used to send an email notification to the requester.

The notification is running against the CCR table and is correctly sent to the requester when the conditions are correct, using an email template.

This template is also using the CCR table.

The issue experienced is that information is missing from the email message being sent.
The number and opened_at fields are empty within the email message sent.

The URI_REF ends up pointing to the scheduled job and not the actual CCR.

find_real_file.png                     find_real_file.png

Also tried leaving the email template empty and have it call an email script, but the number and opened_at are also blank within the email sent.

find_real_file.png

We are on Fuji Patch 13 Hotfix 1.

Any ideas on what the issue may be and the best approach to achieving the requirements, are greatly appreciated?

As always, any assistance is greatly appreciated.

Cheers,

Ron

15 REPLIES 15

Chuck Tomasi
Tera Patron

Can you share the script in the scheduled job and the notification record details?


Scheduled Job:


find_real_file.png


Not quite sure what you mean by "Notification Record Details", but here is the message sent.


find_real_file.png



Thanks for your assistance Chuck.


When you call gs.eventQueue, the second parameter is expected to be a GlideRecord (hopefully the same type as the Table field in the Notification record.)



You are sending it a sys_id. If I'm not mistaken the parms to gs.eventQueue are strings. You are passing objects. Try changing it to:



gs.eventQueue('ccr.reminder', ccr, JSON.stringify(req), JSON.stringify(ccr));



You will need to take care of reversing stringify on the other end (in the template) by using JSON.parse(event.parm1) to get your req object back. Be warned, I've had issues using stringify on GlideRecord objects. Do you need to pass two whole records in this case?



Good luck.


I don't actually need to pass two records, so the last ccr is not necessary.


Oddly enough, ref works correctly without using JSON, as the email is being sent to the correct requester.


I have tried current, parent and ccr right after the event name, but no luck with any of them.



No previous experience with JSON and based on your warning, not sure I'd use it.