BPM to prevent save if custom field is empty

Hi everyone,
I am trying to create a method directive on the Quote Update which will prevent the user from saving the quote if the custom field ProjectID_c is empty. I thought this would be quite simple but I cannot get it to work. I am using this condition;

image

For some reason even when the field is empty the condition returns false.
Any help much appreciated
Best regards
Adrian.

Hello @Adrian_Mepham! Can you confirm that your ProjectID_c is a string, and have you checked that there is not an initial value? In the database after you save the record, what is the value of that field? You can also might be able to add an info box to display the value of the changed row so you can see what the system thinks is assigned at that point in time.

1 Like

if i were you i would use Data In-Transaction BPM on this table

Edit:
also it is worth to check your trigger condition to cover both RowMod status i.e. Added and Updated

1 Like

One other thing sometimes worth trying is expression DBNull.Value. But as already said, making sure the default on your custom field is an empty string gets around the need for the extra checks.

1 Like

Thanks for the responses guys. @josephmoeller the UD field is definitely set to a string. I think that I made the mistake of thinking that If I reconfigured a line on the quote and there was no ProjectID filled in then it would not let me save it but it does. If I actually try to change something on the Header, like 'Best Case % ’ or something, the BPM works. I guess that all new quotes from today will be ok but existing ones that are edited at line level could still have an empty ProjectID field.
I will take you advice @A.Baeisa and move it to an In Transaction Data directive. I will also use DBNull.Value, thanks @dhewi

One quick way around this might be to set your custom field as “required”. That could do away with the need for a BPM entirely.

1 Like

same principle, if you need to capture the update on the line level which i think is QuoteDtl, you need to create another BPM on that table as well

1 Like

I would definitely recommend setting your custom field as required in Extended property. This will save you time and 1 BPM :wink:

Is there a difference between setting this in Extended Property vs during the UD field creation?

And I always feard making an added UD field required, as for how it might affect transactions for records that existed prior to the UD fields creation.

Like if an order was created prior to the UD field, and then the order was updated by another process (like a shipped packer closing closing the order). Would the record update with a blank/null “required” field?

That’s a fair concern. any new update would have to update the empty UD field as well.

When I make a BPM to halt on a missing field (like requiring our folks to enter a Prod Group on order entry) - I’ll add an ANDed condition that the Order Number is > some value (typically the last OrderNum prior to enabling this requirement)

3 Likes

Worth checking out, but we recently SEEMED to find that setting a UD field’s properties in the usual extended properties screen didn’t actually have any effect. It only worked in the UD field screen, where fortunately you can go back and change it after the original creation.

1 Like