
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have a very simple flow to trigger a notification. The flow's trigger is a daily schedule.
The flow's first step is to lookup records using a GlideRecord query. The script used is
var contracts = [];
var grAstContract = new GlideRecord('ast_contract');
grAstContract.addActiveQuery();
grAstContract.addNotNullQuery('ends');
grAstContract.addNotNullQuery('u_notice_period');
grAstContract.addNotNullQuery('contract_administrator');
grAstContract.query();
while (grAstContract.next()) {
var gdt = new GlideDate(grAstContract.ends);
gdt.addDays((grAstContract.u_notice_period * -1) - 30);
if (gdt.getDate().getValue() <= new GlideDate().getValue()) {
contracts.push(grAstContract.sys_id.toString());
}
}
return contracts;
When I log the query and run in on the contracts table, there is a result of 2 records.
Next flow step is a for each item-loop and then send the notification.
The logic works, however only 1 notification is being sent.
It's not a data issue, the selected recipients are active and have an email configured.
I'm stuck and in need of help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Do they also have the email active? User records can be set to not receiving the email.
However: why do you use a GlideRecord query to get the records? Why not simply use conditions (active is true and several fields are not empty and end date is 30 days from now). Those are simple conditions which make it a lot easier to maintain the flow, even after you aren't with the company any more.
For troubleshooting: check the flow execution log. It may show errors.
Also: what are your settings on the 'send notification' action? Did you select the 'for each' record as trigger?
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
2 hours ago
Hi @Kenny_vl
I think the condition should be return an encode query string
the note inside it said:
/**Requires GlideRecord encodedQuery response, example:
**"active=true^short_descriptionSTARTSWITHtest";
*/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Did you check the flow execution and email logs to confirm it is getting triggered only once or it is getting triggered as expected but notifications are not sent to end user(s) ?
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi Bhuvan,
when checking the flow execution, there is another strange appearance. The lookup records is showing me a count of 3, whilst the constructed GlideRecord query only shows 2.
The for each item-loop is showing me an iteration of 3 records also
But only 1 notification is being triggered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
I think you can simplify your flow and I do not see a need to create custom script as the same features can be built using Flow Logic or Filter Conditions in your lookup definitions.
Please check email logs and 'Send Notification' action to make sure it is configured correctly and contract records has email ID configured and users are active and other pre-requisites are met. Since you are using 'Don't treat as Error' to 'true' it could be possible email notifications are not triggered or setup correctly and it is terminating the flow without going through the loop.
You can also refer below thread to see if you have designed the Flow correctly
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
24m ago
Did you get a chance to review this ?
As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan