Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Other user has modified - Web Services ( update method)

Posted on by Microsoft Employee

hi All,

I'm facing this error Message: Other user has modified "Member_Contact" "Account No.=CONST(MHT-00000028),Contact No.=CONST(S7417417Z)"  

 

is there any way to resolve this error? im using php for consuming this web services. 

Please need your badly. Thank you

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Other user has modified - Web Services ( update method)

    Hi Rabindrah,

    this code is $_POST = json_decode(file_get_contents('php://input'), true); is actually reading as json it does not do updating. the only modify happening is

    $res = $client->Update($NavCheck);

    [[*****

         $_POST = json_decode(file_get_contents('php://input'), true);

         $NavCheck  = $client->Read(array(

             'Account_No' => $Account_No , 'Contact_No' => $NRIC

         ));

    ********]]

  • Suggested answer
    Rabin Profile Picture
    Rabin 2,976 on at
    RE: Other user has modified - Web Services ( update method)

    Hi,

    I think this part

    [[*****

    // if account and contact update neccesary fields for contact

          $_POST = json_decode(file_get_contents('php://input'), true);

          $NavCheck  = $client->Read(array(

              'Account_No' => $Account_No , 'Contact_No' => $NRIC

          ));

    ********]]

    is posting the decoded value and just after this event you are assigning the value. Since at this instance the PHP code tries to modify the record in NAV and suddenly after this it again tried to assign the remaining values to $customer variable with final line as an update of record i.e. committing to the NAV again...

    If i understand your code correctly, it still needs to follow the norms of NAV... Avoiding two Modify. Skip one or commit and refresh one and then only move forward with another trigger...

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Other user has modified - Web Services ( update method)

    Hi Rabindra,

    Im using php to consume this web services

    heres my code:

    $name       = $this->session->userdata['logged_in']['Name'];                  

           $contact       = $this->session->userdata['logged_in']['Contact_No'];

           // check if contact and its account number

           $params = array('filter'=>

             array(array('Field'=>'Contact_No', 'Criteria'=>$contact),

             array('Field'=>'Name', 'Criteria'=>'')),'setSize'=>0);

           $resp = $client->ReadMultiple($params);

           $customer = $resp->ReadMultiple_Result->memberDetails;

           $array3 =   json_decode(json_encode($customer->Account_No), true);

           $trim =   json_encode($array3);

           $Account_No       = trim($trim, '"');

           // if account and contact update neccesary fields for contact

           $_POST = json_decode(file_get_contents('php://input'), true);

           $NavCheck          = $client->Read(array(

               'Account_No' => $Account_No , 'Contact_No' => $NRIC

           ));

           $customer    = $NavCheck->memberDetails;

           $customer->Name = $Name;

           $customer->Address = $Address;

           $customer->Address_2 = $postal;

           $customer->City = $City;

           $customer->Phone_No = $Phone_No;

           $customer->Mobile_Phone_No = $Mobile_Phone_No;

           $customer->E_Mail = $Email;

           $customer->Gender = $Gender;

           $customer->Date_of_Birth = $Date_of_Birth;

           $customer->Marital_Status = $Marital_Status;

           $res = $client->Update($NavCheck);

  • Suggested answer
    Rabin Profile Picture
    Rabin 2,976 on at
    RE: Other user has modified - Web Services ( update method)

    Hi webmax,

    This is probably because of the wrong use of MODIFY Function.

    Eg:

    //----------------------

    Function1;                  //Define Function1

    salesline.get();

    Function2(Salesline); // Call Function 2.

    Salesline.Modify;       //<----------- Second MODIFY

    //-----------------------

    Function2(Salesline) // Define Function 2

    ...

    Salesline.modify;     //<----------- First MODIFY

    //---------------------

    Explanation...

    Since here Function2 is called before the data is modified by Function1, but inside Function2 there is already a Modify function.

    *****************

    Solution:...

    1. Try to avoid one Modify.

    2. Commit/Refresh the record after calling Function2. This will make the State stable and you will not get the error message...

    -------------

    -------------

    If your case is different please provide code snippet...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans