Update record when it's open on form

Hello,

On my order form I added a button, when I click on it, I modify the order’s header (I execute a codeunit which makes some thing like :

currSalesHeader.xxx := 000 ;

currSalesHeader.MODIFY;

but it shows me an error which tells me that I have to restart my form because it was modified by another user ?!

I tried to add : COMMIT; after MODIFY but it didn’t work !!

Do you have an idea to resolve this problem ?

thantks for your help.

Actually what you are trying to do???

I have button which update some prices on header and I show it on order’s form.

Hi Raf

Pass the record variable to the codeunit and update that values… [;)]

That’s what I do !

The problem is that I change the header when it is open on the form.

Because it tells me that I have to refresh form ! A****nd it bothers me because it does not finish his treatment, it stops on the MODIFY

Use CURRFORM.UPDATE(FALSE);

No I can’t use Currform.UPDATE because I make the modification in codeunit !!! not on the form !

Hi Raf

Check the release function on Form 43 Sales Invoice… [:)]

They are passing the record variable to and updating the status . You have to update details in same record variable . Suppose you filter other Sales Header variable and update then navision will get error message because in in form and Codeuint record versions are different

Hi,

Perform the similar kind of task like this.

create a code unit and set the table no property as 36 and in the onrun trigger, write the code to modify your sales header.

Call this function from the sale order screen like this.

CODEUNIT.RUN(xxxxx,Rec);

It will modify the sale order screen without prompting any error message

Regards,

Karthik.D

first copy your currSalesHeader to some otherSalesHeader

otherSalesHeader.copy(currSalesHeader)

otherSalesHeader.xxx := 000 ;

otherSalesHeader.modify;