Aggregate total within BPM without using custom code

,

We are a SaaS MT customer and I want to run a BPM that will alert a user doing weekly time and expense entry if the total submitted hours for a week is less than 40hours. Can I call a BO method to run a BAQ and send parameters for the current user and week to get the total submitted hours?

You should be able to just use the condition…the specified query returns a number of rows equal to X… or something like that. Then add criteria in the BAQ so it will only return a row if the there are less than 40. That is unless you can just get to that same logic with the fields on the table, then you could just do something easier like if total hours are less than 40 then throw a message. Not sure if either way is possible for you without looking but that is where I would start.

You would have to add up records up for that, which you can’t do in a BPM (you can’t make calculated fields)

I think you were on to something for the BO method. Check out the DynamicQuery. I think you can run your BAQ to get your sums. Then you can run conditions.

Since this is true in SaaS MT, what are my options? Trying to create a BPM to grab a BAQ result (calculated field) and write the value into a UD table. Seems simple, but running into roadblocks and SaaS limitations.

MT limitations. Not an issue for Dedicated Tenancy.

So for MT, there is no execute custom code widget, right? I am trying to execute a dynamic query with widgets, and I can’t figure it out. There’s nothing to define that will take the output from the dynamic query, the dataset that it’s trying to use is the forms dataset, which doesn’t make any sense. I don’t know how you could do this without code.

The only area I can see where code is an option is in the Set Variable block or the Set Field block. Each of those offers an expression section, which may allow for complete free-typing. Not being very C# literate, I’m not sure how to test the limits of this option.

I think you can only put one line of code in there, which isn’t enough to run dynamicQuery.

Agreed, that appears to be the case. Any way to call a BAQ in this type of expression?

Not that I know of. I don’t think I’ve seen anyone do it.

At the risk of hijacking this thread, can this be done as a UBAQ? I need to run an insert or update to UD table which separately calculates a number and stores it in the UD table.

Maybe?? It looks like you can send in parameters, so you could execute the query (maybe even run custom actions?), but you can’t get back any results in the BPM. But if you send that stuff, I would guess it could do it’s work. I’ve always been able to use code to do it.

edit

It looks like it will fire a pre-proc BPM from a UBAQ when calling ExecuteByID using the widget. So it looks like you can do what you want.