BPM to Prevent a [DMRCorAct] Record From Being Created

In the “Corrective Action” module/form, I am trying to construct a BPM whereby, if a user does not enter a value in the “Assigned To” field (DMRCorAct.AsigndTo), a notification appears to warn the user that this value is required. This BPM works - but - it still doesn’t prevent the user from saving that new corrective action record without an “Assigned To” value being applied/inserted.

What appears to be happening is, when the notification dialog box is cleared (by pressing the “OK” button), a new corrective action record is created anyway.

I actually want to prevent that from happening, unless a value is designated in the “Assigned To” field.

A BO trace suggests that the record update is occuring here:


… which I’m interpreting as a Method Directive, however, the [DMRCorAct] table is being called during the update process, as evidenced by this portion of the trace:

 <changedValue tableName="DMRCorAct" rowState="Added" rowNum="0" colName="AsigndTo"><![CDATA[]]></changedValue>

… which leads me to believe that I’m dealing with a Data Directive, so I’m a little confused on that one.

I opted to go the Data Directive route and built my conditional logic around the “ttDMRCorAct.AsigndTo” field, where, if that field of the added row is equal to “”, then (throw messagebox dialog). Nothing follows the custom code block that presents the messagebox in the BPM.

The two questions I have are:

  1. Is the Data Directive the appropriate handler

  2. There must be more to it than presenting a simple message box to the user so, how do I actually prevent the record from being created?

Here is a small screen capture for reference:

Your message box you select should be an Exception type, not the regular message…
I use it often to prevent record creation as well and works great.

is that what u used?


1 Like

@Hogardy - I did not use the “Raise Exception” block; just a custom code block that allowed me to construct a message box (because I think in Data Directives, the Raise Exception and the Show Message blocks do not exist [at least in v10.1.400.14]).

I’m wondering then, because of this, if I should be using the Method Directive instead?


I used it under Method directive…


@Hogardy - Ok, I’ll give that a shot and report back to the thread concerning my results. Thanks very much !

@Hogardy - That worked. Easy, peasy.

Simple deal - but your advice helped me out a great deal. Thanks very much for spending some time to set me straight. :+1:

You should be able to use an exception in a data directive as long and you use and in-transaction and not a standard directive. The benefit of the data directive, is it doesn’t matter from what screen or input it will stop the user no matter what. If another method can update that field, it won’t stop them using that method.

1 Like

@Banderson - Good point. What I really want to avoid is the creation of a DMRCorAct record without an Inspector record assigned to it. So, possibly, I was on the right trail assuming Data Directive, but was using the wrong “type”, as I did employ the standard DD previously, not the In-Transaction type.

I think that the naming convention for those is pretty odd. From my experience, you would rarely use “standard” and almost always in-transaction. Standard is used for change-log and things that give the user no-feedback, which isn’t much…

Roger that. I’ll adjust back to the (in-transaction) Data Directive to ensure that no CA record is created from any module without the “Assigned To” field being populated, as well.

@Hogardy - Even though I’m switching the solution on this one, Hogardy - you got me there, brother!

@Banderson - I just tested this as an In-Transaction Data Directive and it works just as well as the Method Directive that @Hogardy had suggested earlier, so I think I’m good to go (with the added protection of triggering the exception any time a new DMRCorAct record is created from any module in the system).

Thanks to you both for helping and getting me situated nicely.

just in case if you want to show exception message within your code

CallContext.Current.ExceptionManager.AddBLException("Message1 ");

bear in mind this means that your code will stop at this point until the exception condition is changed.

1 Like