How to use dynamic expressions in Process/Trigger arguments?

A Process has an argument named EmailQuery. I want to use that in the Get Mail activity for the query. But I may want it to be dynamic ie:

“subject eq '‘My Subject’ and sentDateTime gt " + Now.ToString(“yyyy-MM-dd”) + " and hasAttachments eq true”

If there’s no way to make this work, I guess I’ll need a timespan argument and use a DateAdd to calculate the value for the query.

@postwick

If I am not wrong…what you want is to pass the query for filter as and input argument at the same time need datetime to be current ?

If yes then can use a tag in your input expression and use replace in your code

Eg : subject eq 'Subject' and sendDateTime gt '<DATE>'

And in code use in_arg.Replace("<DATE>",Now.ToString("MM-dd-yyyy"))

Cheers

That doesn’t do any good. It’s still just always going to be “today.” What if I want the query to pull emails for “the last two days” which would be:

sendDateTime gt DateAdd(DateInterval.Day,-1,Now).ToString("MM-dd-yyyy")

In the end I just used an int32 argument EmailLastXDays and then DateAdd(DateInterval.Day,0-EmailLastXDays,Now).ToString("yyyy-MM-dd") when building the email query.

That accommodates my needs for this automation, but it would be nice to be able to use more dynamic expressions in Process/Trigger arguments.

1 Like