how to set alert and test activity to compare when file found and no file found | Community
Skip to main content
Level 4
January 28, 2024
Solved

how to set alert and test activity to compare when file found and no file found

  • January 28, 2024
  • 3 replies
  • 1201 views

 

 

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

 

 

 

 

@parthasarathy

@ParthaSarathy 

@ParthaS 

@AkshayAnand 

@Craig_Thonis 

@Manoj_Kumar_ 

@Amine_Abedour 

@Marcel_Szimonisz

@DavidKangni 

@Amit_Kumar 

@ShashankNigam02

@Ganesh5067

@Jonathon_wodnicki

 

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ParthaSarathy

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.

 

 

3 replies

Level 3
January 28, 2024

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.

 

Manoj_Kumar
Community Advisor
Community Advisor
January 28, 2024

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.

 

Manoj     Find me on LinkedIn
Level 4
January 29, 2024

thank you so much

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
February 2, 2024

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.

 

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups