- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 02:36 AM
Hello,
I have a requirement to have a record (RITM) automatically generated on the 1st day of January, April, July and October. The triggers in Flow Designer are not that specific and therefore I am wondering if I can use a script, such as the one below, in Flow Designer to specify when the record is created?
var objDate = new GlideDateTime();
var month = objDate.getMonthUTC();
gs.log("Current month - " + month);
if (month == 1 || month == 4 || month == 7 || month == 10 || month == 12)
Note, this script is taken from an attempt at completing this requirement as a Scheduled Job, but the Scheduled Job doesn't generate the RITM as intended. It'd be easier if I could add this script into FD and complete the requirement this way.
Many thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:05 AM
Hi @NathanHaywood, Can you try the below steps?
1. Create an Script Action to check the month
(function execute(inputs, outputs) {
var correctMonth = false;
var objDate = new GlideDateTime();
var month = objDate.getMonthUTC();
if (month == 1 || month == 4 || month == 7 || month == 10 || month == 12){
correctMonth = true;
}
outputs.good_to_go = correctMonth;
})(inputs, outputs);
2. Flow steps:
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:25 AM
You need to create an output variable good_to_go as suggested by @SunilKumar_P and then it would be available in your flow.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:31 AM
Hi Amit, thank you.
I have created an Output Variable as below:
What do I need to configure in terms of Action Output?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:39 AM
Now you can make use of this good_to_go variable in your flow to evaluate the If condition. Please refer the flow snip shared by @SunilKumar_P to configure the if condition.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.