Make Attachment required before saving Order

I am looking to make it mandatory for a customer PO to be attached to a sales order before the order can be saved…is there an easy way to make the system check that there is a least one attachment on the order before can be saved? Can I do that through a BPM on one of the sales order Methods?

Extended Properties can set this field as Required.

that attachment field? isn’t that under the Xref table? I want to make sure they attached a PDF to the sales order before it can save

Are you wanting to require a document on the Sales Order?
If so, you will need to allow the saving of the Header, but can prevent a creation of a line with a BPM on GetNewOrderDtl.
This won’t work for converted quotes though.

We rarely (if ever) convert from a quote so that isn’t and issue. What condition would I put in the BPM for it to throw and error if there isn’t an attachment?

In pre-processing use a query to check if there is a related attachment. Then error if not.

1 Like

I would put a condition on Update and use a condition widget using Number of rows in designed query is more or equal to 1. The query would look at Ice.XFileAttch. If wanting the PO attached at the Header you would use RelatedToFile equals OrderHed and Key1 equals OrderNum. You can join Ice.XFileAttch to Ice.XAttachMetaData to find specific attachment types

1 Like

Thanks Guys! Appreciate the help as always

Hi Dan

So running into one issue…when I try and link the two tables, its throwing an error as OrderNum is and integer, where as Key1 is a string…when I link them in a standard BAQ it doesn’t have an issue, but as soon as its a query within the BPM it doesn’t like it…what am I missing?


I would create a variable within the BPM named OrderNumber as a type string. You can then use a set variable / argument and set OrderNumber to your tt.OrderNum.ToString(). Then in the BPM Query you can just use the variable and this also avoids the pitfalls of having the tt table joined in the query.

Ok that was the route I was going, but was still getting an error…so I think i am doing something wrong. Compilation error I am getting is:

BPM is set up as such;

Put double quotes around OrderHed in the criteria

1 Like

Ok that stopped the error in compiling!

Thanks Dan, appreciate your time!!

I get this error. Did you as well? If so, how did you fix it?

Take off the ToString() - it appears your OrderNum variable is an int.

1 Like

That resolved that issue, but now when I enable to the pre-processing I get this error.

Whats the code for your condition widget?

I see what you were going for. Key 1 is a string, so you wanted to convert your order integer into a string. Which ever way you go, make sure they are all the same datatype all the way through. Take a look at the datatypes for each widget and variable.

orderNum is set to default type System.Int32