Make Attachment required before saving Order

Your variable @orderNum is an int, also the value in OrderHed.OrderNum is an integer. However the value in XFileAttch.Key1 is a string value. In order to use order number in key1 it has to be a string. Therefore, you have to change the datatype for your @ordernum variable to a string. Once you do that, you should be able to use the ToString() part that you took off in your first step.

Is there a quick way to change the datatype for orderNum from an int to a string?

You already had it. Look at your first widget. Its a set variable. What is the datatype for the variable orderNum? You set it in the variables tab. click over there, and change it to string. Once you do that, change your code back to dsOrderHedRow.OrderNum.ToString().

1 Like

It works now, thanks for the help!

1 Like

So this setup should throw an error if there is no attachment attached on the order correct? Will it throw an error when the order is initially created or whenever the save button is clicked?

I actually don’t know. I didn’t set this one up. It looks like the OP showed it sending either a message box or raising an exception. You will have to do some trial and error to figure out exactly when it fires.

When adding a new line to an order, even though there is an attachment in the OrderHed I get this error:

What method did you put this BPM onto? Do you only want to check for attachments when the SO Header is created or at each line added?

I put this into the Pre-Processing for Erp.BO.SalesOrder.GetNewOrderDtl

I want to check for attachments right at the start before entering the first line but once the order number is generated

Possible there isn’t a SONum yet on that method. setup a BPM that’d display a message box with the data you need to pass into the BAQ (Company, SONum, etc) to see if the data is available to you at that point.

at what point and method would I have this BPM run to display that data?

Do the “troubleshooting” Message box in your BPM. Don’t connect up and widgets that aren’t working, like that BAQ one. I’d connect it where I pointed and disconnect the rest of the BPM widgets.

2 Likes

This is important for debugging. I always have a message box setup to show common variables I am using, and the table view of any datasets I am using. I put it in just before the first widget that I think might be the problem one, and make sure not to connect up the problem widget. Then just connect one at a time. Keep moving the message box to the end of the line and eventually you will find the place where it breaks.

2 Likes

Is there a way within the BPM to have the test results popup, or would I have to create a real order in the system to have something show once the BPM is enabled? Or is that where I would turn the “Debug Mode Only” button on in the message?

You should be using “real” test data in the test environment. I never use that debug mode check box. Curious when I should use it.

Creating simulation data to input is one of the hardest things to do. You have to simulate the way your end users will enter data.

1 Like

You can set message boxes to “Debug Mode” and when having the BPM set to Debug mode it’ll display those messages. When you turn it off you won’t but that’s a pretty new feature so many of us are used to unlinking the Debug message manually. IIRC debug mode also writes more to the logs but I honestly don’t use it as we’re still on 10.2.x where it’s not available.

2 Likes