Hello Rohit !
Thank you for posting on Microsoft Learn Q&A.
pipeline().TriggerTime only has a value when the pipeline is started by a trigger and when you run the pipeline manually pipeline().TriggerTime is null, so formatDateTime() / addMinutes() blow up and ADF wraps that as a generic BadRequest.
You can use utcNow() when there is no trigger time:
@formatDateTime(
addMinutes(coalesce(pipeline().TriggerTime, utcNow()), -5),
'yyyy-MM-ddTHH:mm:ssZ'
)
and
@formatDateTime(
coalesce(pipeline().TriggerTime, utcNow()),
'yyyy-MM-ddTHH:mm:ssZ'
)
So your start time” and end time become:
- Start time
@formatDateTime( addMinutes(coalesce(pipeline().TriggerTime, utcNow()), -5), 'yyyy-MM-ddTHH:mm:ssZ' ) - End time
@formatDateTime( coalesce(pipeline().TriggerTime, utcNow()), 'yyyy-MM-ddTHH:mm:ssZ' )
When the pipeline is started by the schedule trigger, pipeline().TriggerTime is used and when you run manually, pipeline().TriggerTime is nullthe coalesce() uses utcNow() instead.
For the filter 1, that’s OK if filenames always contain today’s date. If you want it aligned with the trigger window instead of now, you could also use coalesce(pipeline().TriggerTime, utcNow()) here.
Items: @activity('Check_Full_Folder').output.childItems
Condition: @contains(item().name, formatDateTime(utcNow(), 'MMddyyyy'))
For the 2nd filter, do the same for the custom & parent folders.
Items: @activity('Full_Folder').output.value
Condition: @greater(
ticks(item().lastModified),
ticks(addMinutes(coalesce(pipeline().TriggerTime, utcNow()), -5))
)
If condition only run when all 3 folders have new file, you can run only if each of the three arrays has at least one element and if you actually want “run if any folder has a new file”, replace the outer and with or
@and(
greater(length(coalesce(activity('Full_Folder_UpdatedFiles').output.value, [])), 0),
and(
greater(length(coalesce(activity('Custom_Folder_UpdatedFiles').output.value, [])), 0),
greater(length(coalesce(activity('Parent_Folder_UpdatedFiles').output.value, [])), 0)
)
)
Inside the true branch you keep your real work and in the False branch you leave it empty or maybe log no new files.