Skip to Content
0
Sep 27, 2016 at 07:33 PM

Get last Payment Draft DocEntry added by user

401 Views

Hi all. I have a problem with Payment Draft Document.

We set an approval procedure to Outgoing Payment. So when a user add Outgoing Payment Document it firstly add Payment Draft Document.

So in the Form Data Event I wrote that

if EventType==Add and BeforeAction==False Then

string objectCode=oCompany.GetNewObjectKey();

string objectType=oCompany.GetNewObjectType();

But these two methods always return an empty string. I noticed that if I will add document by code (calling Add() method) then after calling these above two methods does not return an empty string.

The problem is that these methods don't work when user adds document normally.

I don't think that writing query is a good idea. Like SELECT MAX(DocEntry) FROM OPDF.

Because you cannot be sure that DocEntry always increases by adding +1 unit.

For example we have A/P Invoice document with DocEntry 1, 2 ,6, -8, -10 and etc.

So what is the best way to get DocEntry when user add?

1.With help of SBO_SP_TransactionNotification(calling method in it)

OR

2. With help of DI Event Service.

P.S. I never used none of them.

Please, help me to resolve my problem.

Thanks in advance.

Regards, Kamil.