Result difference from Email Notification script and Background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:24 AM - edited 06-05-2024 05:34 AM
Hello All,
I'm trying to redirect user to specific page url but in the url i need to pass assessment instance Id.
when i checked the below code it's getting Assessment sysid in background script but the same script when I tried using in email notification script it's not showing the sysid in logs also and in url.
Background Script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:36 AM
Have you tried 'at.addQuery("task_id",current.getUniqueValue()")
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:41 AM - edited 06-05-2024 05:59 AM
Hi Mark,
Thanks for quick response.
I tried by updating as per your input but it's still the same.
Updated Code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:59 AM
Can you add logging to your script, because I am very curious what your variables return.
You are getting the userID from the currently logged in user (gs.getUserID()). But you are calling that from an email script to create a link. So the 'currently logged in user' probably doesn't return any useful user, or at least none to be found as user to whom an assessment instance is assigned.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 10:47 AM
I would have to agree with @Mark Manders. Using gs.getUserID() in the email script will not have a proper user SYS_ID as the notification engine is running this script and not the user who kicked off the action. You will need to use another field from the "current" record which will give you the user sys_id you are looking for, or kick off the notification from an event and pass in the users ID as a parameter in gs.eventQueue. This will require you registering an event as well in the system. Once you did that though you could use the event object from the mail script to retrieve the passed in User ID parameter.