Renaming Customer Price Group Loses Prices

dave_cdave_c Member Posts: 45
When you rename a customer price group the sales code on the sales prices isn't updated to the new name. It just stays with the old name so the price group no longer has any prices associated with it. I can see why this happens, the ValidateTableRelation property is not set on the sales code field of the sales price table. I cannot understand the business logic behind it though. Does anyone have any ideas before I log a call with Microsoft?

Comments

  • mark_aumark_au Member Posts: 40
    I found the same problem when renaming customers:

    viewtopic.php?f=32&t=64845

    I haven't been able to find anything about it, and don't have the ability to log with Microsoft currently :( I was going to test re-enabling the ValidateTableRelation and having a play with it, or failing that, just write some code in the rename trigger of the Customer to update related discounts/prices for now.

    If you log it with MS, please let me know what they say :)

    Cheers,
    Mark
  • dave_cdave_c Member Posts: 45
    Hi,
    I should have update this thread at the time. I logged it with Microsoft and it was fixed in CU9. They've added code to the delete and rename triggers of the Sales Price Line:
    OnDelete()
    UpdateSalesPrices(FALSE);
    
    OnRename()
    UpdateSalesPrices(TRUE);
    

    to call the below new function:
    LOCAL UpdateSalesPrices(CreateNewSalesPrice : Boolean)
    SalesPrice.SETRANGE("Sales Type",SalesPrice."Sales Type"::"Customer Price Group");
    SalesPrice.SETRANGE("Sales Code",xRec.Code);
    IF CreateNewSalesPrice THEN
      IF SalesPrice.FINDSET THEN
        REPEAT
          NewSalesPrice := SalesPrice;
          NewSalesPrice."Sales Code" := Code;
          NewSalesPrice.INSERT(TRUE);
        UNTIL SalesPrice.NEXT = 0;
    SalesPrice.DELETEALL(TRUE);
    
Sign In or Register to comment.