i want to run a import workflow that is scheduled to run in every 30mins
now if no file is received in last 5hours i want to send an alert
please help me how can i achive this
i know this can be achived like
a File Transfer activity and enable the 'Process missing file'. In the file found transition, store the datetime in which the file was received in an option or variable. When there is no file, compare the current datetime with the time stored in the option or variable and send an alert.
but m unable to set option varibale like how to get bith dates and comapre in test acticity
please help me with the code for test and js activity: date comparison
please help m stuck here
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Shruti1 ,
You can also try below approach,
Connect a JavaScript Code activity in 'Ok' transition of file transfer, and enter the below script inside JS code activity
logInfo("File Processed")
'No file' Transition:
Query:
Targeting & Filtering Dimension: xtk:workflow
Filtering Condition:
@internalName equal to internal_name_of_current_workflow
AND
Message (log) do not exist such as
@message equal to File Processed
AND
@logDate equal to SubHours(GetDate() , 5)
Test Activity:
vars.recCount > 0
And configure the Alert activity.
Now when there is file present, 'File Processed' log will get generated. If there is no file processed in last 5 hours, an Alert will get triggered.
Views
Replies
Total Likes
Hi @Shruti1 ,
If you are importing from SFTP, add an "Archive" folder there, and start moving files to archived when processed. Now you will have only the latest file in your incoming folder. While Importing file in AC, you can now add a test activity and Alert to process the alert in case of missing file.
Views
Replies
Total Likes
Hello @Shruti1
Once the file is ingested successfully set the Option by this code:
setOption('lastingestion',new Date());
Then, in the new workflow, use this code to check the difference between the last ingestion and the current time.
var lastingestion=getOption('lastIngestion')
var now=new Date();
instance.vars.hoursDiffer = Math.abs(now - lastingestion) / 36e5;
Then, use the test activity to check if the difference is 5 hours.
thank you so much
Views
Replies
Total Likes
Hi @Shruti1 ,
You can also try below approach,
Connect a JavaScript Code activity in 'Ok' transition of file transfer, and enter the below script inside JS code activity
logInfo("File Processed")
'No file' Transition:
Query:
Targeting & Filtering Dimension: xtk:workflow
Filtering Condition:
@internalName equal to internal_name_of_current_workflow
AND
Message (log) do not exist such as
@message equal to File Processed
AND
@logDate equal to SubHours(GetDate() , 5)
Test Activity:
vars.recCount > 0
And configure the Alert activity.
Now when there is file present, 'File Processed' log will get generated. If there is no file processed in last 5 hours, an Alert will get triggered.
Views
Replies
Total Likes
Views
Likes
Replies