Moving code from Method Directive to Data Directive generates an error

,

Hi everyone,
I have a BPM which was compiling and working as a Method Directive, I then realised that I needed a Data Directive instead.
In the References and Usings area I have ‘Erp.Contracts.BO.Task’.

When I move the code to an In Transition DD, I get this error. Can anyone tell me what I need to do to correct it?

The type or namespace name ‘TaskTableset’ could not be found (are you missing a using directive or an assembly reference?)

Thanks in advance
Adrian

Data Directives only work on the current table. There is no notion of DataSets like you have in Method Directives that work on a Business Object. Think database trigger.

1 Like

Thanks @Mark_Wonsil, I thought about it, and googled database trigger but still not sure what I need to do. The directive is on the SysAgentSched. I am trying to get it to run on a schedule

I think you have to abandon the notion of BO’s in a DD (aside from the Execute BO widget).

You might need to make a MD (Method Directive) for any BO related functionality, and call that MD from the DD.

1 Like

Thanks @ckrusen, I had a feeling that it was never going to work.

Is it an easy thing to do? I straight away looked in hope for a widget but there doesn’t appear to be one. Is it done in custom code?

Whoops … I was think of the conditions when a Pre- and Post- MD are required. Not about mixing DD’s and MD’s.

Why did you have to move the BPM from a MD to a DD? Because other BO’s may invoke the change your original MD was trying to account for, and don’t want to have near duplicate MD’s for all the different ways the field and table the DD monitors could be changed?

I think of MD’s as being used when a “function” happens. And DD’s when a “variable” (the DB table) is changed.

Just a tip that helps if you are used to using a method directive with the BO widget and then need to convert it to code. Assuming you are on-premise, you can do this for a little cheat or help.
1. Create method directive with BO widget and enable
2. Look in the Folder where your app server is installed and in the \BPM\Sources\BO\ and then in the method you used (task.update in example) and then the most current folder. Open that folder.
3. Open the Pre or Post update .cs file and you can see how the widget was converted to C# code
4. You can pretty much copy the code, add some references, and be off and running.

1 Like

This isn’t 100% true. I’m building a BPM as a Data Directive that uses all code and can make BO calls.

The fact that there is no Call BO widget in DD’s makes my statement 100% false

I’ve had issues copying code widgets between BPMs. Same thing happened where the references weren’t recognized. Usually I just rebuild the BPM from scratch or copy everything but the execute code blocks.

perhaps try

using Ice.Tabletsets;
using Erp.Tables;

if you did an include in your widget code, and then copied the widget, for some reason, it doesnt recognize the include UNTIL you open up the include screen and save… THEN it works. You dont have to do anything other than open/close/save.