Custom code -> Workflow Widgets (foreach question)

I am converting some code widgets to standard widgets in the BPM Workflow Designer and I have a question. The example below begins with a foreach, but I’m not sure how to recreate that in the Workflow Designer. Do I need to? If so, what is the best way to do this?

Capture1

Capture2

One of the downfalls of the widgets is you can’t loop with them. (At least not easily, there probably is a way)

There is an it’s ugly and slow LOL

Ahh. Thanks.

Do cloud customers have the ability to run code like my example, or are they forced to use widgets?

That depends on your definition of cloud. RIght @Mark_Wonsil?

Is there value in using widgets when possible? I’ve heard them recommended at user groups before. Will having them in place as much as possible allow for easier updates in the future?

Theoretically yes, they are more likely to regression test things that are done with widgets, and they guide you to best practices. It really depends on how crazy you get with the coding.

@Banderson is correct. Dedicated Tenant (aka Public Cloud Users) and single tenant users can run code as you listed. Multi-Tenant users (different companies in one database) cannot. Even then, you can submit code for Epicor to review and they might install it for you. But Epicor doesn’t even sell MT any more and the sooner it’s gone, the better it is for everyone. Buh bye.

Looking at this… there is only going to be one OrderHed record, so you should be able to simply create a single setter widget that sets ServRef1 = "CustomerPO: "+ ttOrderHed.PONum

BUT if you had multiple tt records, this could also be done by creating a Variable, setting it to the value, and then using the “Set by Query” widget… this widget allows you to select all applicable tt records, and populate them with a value (the new variable you calculated).
image

1 Like

But that would set all those records to the same value, no?

When I think of looping, I think that each iteration might need to do things slightly different. Like if you wanted to loop through OrderHed records and set the PONUm to "Verbal: " + OrderNum

except, it a data directive of this type, I believe that you will only find one TTOrderHed record per transaction.

1 Like