I just tested it and I do get the error.
Code: Select all
Another user has modified the record for this Item after you retrieved it from the database. Enter your changes again in the updated window, or start the interrupted activity again. Identification fields and values: No.='1000'
From webservice.
My test codeunit looked like this.
Code: Select all
Item.GET('1000');
SLEEP(10000);
Item.VALIDATE(Description,'Bicycle WS');
Item.MODIFY;
So while the WS was waiting I modified the description on the item with another client.
*This post is locked for comments
Hi Mouli,
yes that's correct. While the WS process was waiting on sleep your item record became outdated from the modification of the other process. That's how it should work. If you want to grant exclusive access to the WS, then you need to lock the item table. And, depending of the context (WS with a page and a codeunit), you may also need a SELECTLATESTVERSION to get the current version of the records. The WS code should look like this:
SELECTLATESTVERSION;
Item.LOCKTABLE;
Item.GET('1000');
SLEEP(10000);
Item.VALIDATE(Description,'Bicycle WS');
Item.MODIFY;
This code will only execute when LOCKTABLE() succeeds. But that's the point :)
with best regards
Jens
Sohail Ahmed
2
mmv
2
Amol Salvi
2