cancel
Showing results for 
Search instead for 
Did you mean: 

what is Key (docentry) of order just added?

Former Member
0 Kudos

Hi everyone,

On pressing the "Add" button for a new sale the "et_Item_Pressed" event fires twice, before and after adding. Although a default sale order number (docnum - form Item "8") is displayed and can be determined during the "before" event, this number is not reliable because a different, higher, number could be used if someone else has started another sale and saved it before yours.

No useable number is available during the "after" of the Item_Pressed event because the form has been cleared to prepare for adding another sale, and item "8" holds the next default number.

In other words, during the "After" of the "Item_Pressed" event for item "1" (Add) how do I determine the key (docenry) of the sale order just created.

Thanks for any help.

Mel Dodd

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mel,

hence you use the UI to add the document, the only reliable way to know the docentry is by adding a hidden UDF to the document which will be populated with a unique number (lets say a random GUID + user ID) before the Add. after the document was added you should search for the document with this unique ID you will be able to get the correct docentry

let me know if you need more info or sample code

Moty Moshin

rasmuswulff_jensen
Active Contributor
0 Kudos

From SBO2005A SP01 a new event called FormDataEvent will give you the information. It works very great ... Untill then the GUID options works fine...

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This is wat i did. I created a edittext to store a unique GUID. Then i used VB.NET function to create a unique GUID something like this

sGUID = oCompany.UserName & "-" & Guid.NewGuid.ToString

to make it more unique, i would put the username that generated that GUID. After able to identify the last record added, i would update to remove to GUID added cause there might be chance in the future where the GUID will repeat again.

Hope this helps