Email Reminder (Flow designer)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 05:53 PM - edited 11-28-2023 05:56 PM
Hi!
I have this flow designer and it sends email reminder to a user.
The prob is it seems that the flow designer is not getting the other records output value.
I've set a condition here that "If send date is 2" (2 means - email send date is 2 DAYS apart from today's date.)
So it shows here in the 1st record that the email send date is 4 days apart from today's date .
However on the 2nd record and the other records, it shows the same "4" (All of the records have different dates on when the email was sent so its impossible to be 4 days apart from today's date)
Here's the script for my flow variable "send date":
var gr = new GlideRecord('custom_table');
gr.addEncodedQuery('u_sent=true^u_notification=test');
gr.query();
while (gr.next()) {
var send = gr.u_send_date
var dateField = new GlideDateTime(send);
var nowTime = new GlideDateTime();
var dur = new GlideDuration();
dur = GlideDateTime.subtract(dateField, nowTime);
var days = dur.getDayPart();
return days;
}
I'd appreciate any help . Thank you so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 07:34 PM
Hi @Dizy M
As per your script it always sets the send date variable to first record. That's the reason you are getting 4 for all records.
To fix this behaviour, you need to modify your encoded query part in script to fetch the record specific to your record in the iteration.
Please mark my answer helpful and accept as a solution if it helped 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 05:38 AM
Hi @AnveshKumar M thank you for this . however , it really doesnt get all the records, it still shows the same value "4".