How to make sales order / credit memo could only be deleted by its own creator ?

Hello, please kindly help me.

My user complain that every time she/he created a sales order, other people accidentally delete them.

How to modify my navision so that each sales order / sales credit memo can only be deleted by their own creator.

I am using navision 4 sp3. And i’m kinda newbie to navision as well. :slight_smile:

Do you have any field in Sales Header to check who has created the Order?

@mohana

Yes, the field no 50070 and named Creator

Hi Lie

try Sales header on delete trigger

TESTFIELD(Creator,USERID);

Akhilesh, thanks for your reply. I have tried that but It’s not working.

Field creator automatically filled with user who created sales order.

For example : user with id RONNY created a sales order, then the field for that sales order will automatically filled with value RONNY.

i think testfield can’t be used because it will only check if the value in that field is null or not.

No

if the contents of Field do not match with the value , an error message is displayed.

check the link

http://msdn.microsoft.com/en-us/library/dd301274.aspx

debug the code and check

Where did you write the code?

You should write it in OnDelete trigger of Sales Header table…

@Akhilesh & Mohana

Sorry, my mistake, i have tried it and it’s working.

One more thing to ask,

is there any function to show message box so that whenever creator field doesn’t have same value as UserID (through a testfield validation) a message box with my own personal word appear.

You need to try with below code

IF Creator <> USERID THEN

ERROR(‘Your words here.’);

Another approach - if you associate User with respective SalesPerson, SP ID is entered automatically as s/he creates docs, and, the list is automatically filtered, so s/he sees only own docs.
Of course, user can remove this automatic filtering, but accidental erasure is somehow limited. I don’t like restrictive coding, you may never know what sometimes can show up - better is a trained user…