Run a BO Method from a Data Directive

Good afternoon,
I have an in-transaction data directive on JobHead.Update. If you check the Released checkbox, and you haven’t checked off JobHead.CheckOff2, then an error message warns you about it, then checks the box for you and lets you go on your merry way.

The problem is that someone has setup a global alert such that when someone click on CheckOff2, a pre-defined memo is saved with the name and date/time of the change. We want to duplicate this activity within the data-directive so that when you forget to check it off, the system warns you, checks it off, and submits the memo.

I don’t see a widget for Invoke BO Method in the data directives. What is the best way to force this memo to happen without user input? Update Table by Query? Do I need a method directive?
Thank you!
Nate

Invoking a BO from a Data Directive is generally a bad idea. There is a not inexpensive tax to run a business object on what’s essentially a Database Trigger.

I would move what you need to move to a method directive. Generally try to keep your data directives very quick and inexpensive.

1 Like

Have you tried a pre-processing method directive on the Job.Update method? It MIGHT work in this case… in the Job.Update, make a condition checking for the JobHead.JobReleased field has changed from “Any to true” as the condition. Then in the action, also mark the checkoff2 value. YOu might just find that everything works by itself.

2 Likes

I can give that a shot. I don’t know which method is adding the global alert to the jobhead record. I didn’t see anything obvious in the trace. Do you know what method to use to insert a global alert as a memo?

That worked like a charm, Tim! Thank you!

1 Like

Don’t you love it when you find out that you were trying to hard, and the answer was really simple?

1 Like