- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:05 AM
Hello,
I have created an widget on RITM page to trigger an reminder email but I'm unable add query for current RITM that is displayed.
If I removed gr.addQuery('document_id', data.sys_id); then it's triggering approvals for all my requests.
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
var gr = new GlideRecord('sysapproval_approver');
gr.initialize();
gr.addQuery('state', 'requested');
gr.addEncodedQuery("sysapproval.u_requested_for=javascript: gs.getUserID();");
gr.addQuery('document_id', data.sys_id); // Not Working
gr.addQuery('source_table','sc_req_item');
gr.query();
while (gr.next()) {
gs.eventQueue("approval.reminded",gr, gs.getUserID(), gs.userName());
gs.log("Email triggered for = "+data.sys_id);
}
Can you please correct me where I did wrong, notification should sent to current RITM only ?
Thanks,
Tarun
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:43 AM
Hey ,
then i think the problem is with document id field , its always a mess with this type of field .Instead of Document ID field which is "Approving" of approver form there is one more field which stores the approval record sys_id which is "Approval For"
can you please try replacing the addQuery like below
gr.addQuery('sysapproval', data.sys_id); // query with Approval for instead of document_id
I tried to query with Approving for field and it worked for me
can you please try this ?
Please accept the solution if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:11 AM
Hello,
Did you try to check the log what is coming in data.sys_id variable ?
and can you tell me if in the URL of the RITM page do we have &sys_id = "12345" something like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:37 AM
Thank you
.com/sp?id=ticket&table=sc_req_item&sys_id=97928746878c111009fbb91acebb350b&view=sp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:43 AM
Hey ,
then i think the problem is with document id field , its always a mess with this type of field .Instead of Document ID field which is "Approving" of approver form there is one more field which stores the approval record sys_id which is "Approval For"
can you please try replacing the addQuery like below
gr.addQuery('sysapproval', data.sys_id); // query with Approval for instead of document_id
I tried to query with Approving for field and it worked for me
can you please try this ?
Please accept the solution if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 04:54 AM
Thank you