Options

Running business logic from web service

genericgeneric Member Posts: 511
edited 2009-02-26 in NAV Three Tier
Hello

I am writing a test webservice to modify the customer record name, and it's not modifying the ""Search Name". Is there something I'm missing? Here is my code. What do I need to do to run business Logic?
            CustomerWS.Customer_Service service = new WebServiceApp.CustomerWS.Customer_Service();
            CustWS.UseDefaultCredentials = true;
            CustomerWS.Customer Cust = new WebServiceApp.CustomerWSr.Customer();
            Cust = service.Read("10000");
            Console.WriteLine(Cust.Name);
            Console.WriteLine(Cust.Search_Name);
            MyCust.Name = "test2";
            Console.WriteLine(Cust.Name);
            Console.WriteLine(Cust.Search_Name);
            service.Update(ref Cust);

thanks

Comments

  • Options
    kinekine Member Posts: 12,562
    You need to check it after the update, the record is transfered and the business logic is called by insert/update/delete, not just by assigning the value (I suppose)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    Tom_CorneliusTom_Cornelius Member, Microsoft Employee Posts: 18
    That's correct. There is no business logic built into the service objects you have created in your code. The properties will be updated after making a call into the web service (i.e. update, read, etc.). In general, all business logic is executed on the NAV server when invoked from web services, or role-tailored client.
    Tom Cornelius
    Test Lead
    Microsoft Dynamics NAV

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Options
    genericgeneric Member Posts: 511
    ok so the business logic is executable on update, insert.

    My question is still is why isn't the "Search Name" updated when I go to the Customer Card?
  • Options
    kinekine Member Posts: 12,562
    You never told us that the Search name is not updated when you look at the modified card through RTC or CC. I though that you mean it is not updated when you execute your code, because you are displaying the search name before the business logic is executed...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jreynoldsjreynolds Member Posts: 175
    Updating the Search Name on the customer table involves the use of xRec to compare the previous value of the Name field to the Search Name field. An earlier version of NAV 2009 (CTP3 or CTP4) had a bug with web services where xRec was not being set properly. This was supposed to be fixed in the final release of NAV 2009, but I have not had a chance to test it. It could be that this error still exists.
  • Options
    genericgeneric Member Posts: 511
    The bug is still exists. If Search Name is blank it populates it. If Search name is same as Name it doesn't overwrite.

    Also does it know the sequence of validation of fields if validation happens on update,insert?
  • Options
    kinekine Member Posts: 12,562
    I think that the sequence is in ID field sequence...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    genericgeneric Member Posts: 511
    Are they going to fix this :bug: in SP1 for 2009?
  • Options
    Tom_CorneliusTom_Cornelius Member, Microsoft Employee Posts: 18
    It's being looked at, but I can't tell you whether or not it will be fixed.
    Tom Cornelius
    Test Lead
    Microsoft Dynamics NAV

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Options
    genericgeneric Member Posts: 511
    It's being looked at, but I can't tell you whether or not it will be fixed.


    Thank you? :?
Sign In or Register to comment.