How to refresh SalesLine if I change SalesHeader

selece28
selece28 Member Posts: 316
Hi all,
I have a problems
My client want me to customize Sales Order Form, so that if i change the Location Code on the Header, all Location Code in the Line is change according to the Location Code in Header.

Here's the scenario
My client want the Sales Order only sale items from 1 location (No multiple location)
If i input the Location Code on the Header, then input the Line, the Location Code will follow the Location Code in the Header.
But after i input some Line, lets say 10 lines. Then i realize i input the wrong Location Code, can i just change it on the Header, and the Line will follow?

I add the following C/AL code in the Location Code -OnValidate() on the Sales Header table:
SalesLine.RESET;
SalesLine.SETRANGE("Document No.","No.");
IF SalesLine.FIND('-') THEN BEGIN
REPEAT
  SalesLine."Location Code" := "Location Code";
  SalesLine.MODIFY;
UNTIL SalesLine.NEXT = 0;

This Code works but it only refresh the line if i close the form then re open or click the line one by one. Is there any way to refresh all the line after i change the Location Code on the Header? I'm confuse ](*,)

Thanks in advanced
______________

Regards,
Steven

Answers

  • ara3n
    ara3n Member Posts: 9,258
    edited 2007-02-23
    Design the form and add to the location filter onaftervalidate trigger. currform.update(true);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • selece28
    selece28 Member Posts: 316
    Yes all the line is updated when i change the Header
    But now the Header won't change
    I add the [currform.update(false);] in the Header form, is that right?
    How to make the Header change and the line change according to the Header

    Thanks
    ______________

    Regards,
    Steven
  • selece28
    selece28 Member Posts: 316
    Never mind, i figure it out
    i use currform.update(TRUE);
    It works
    Thank you ara3n, my problems solved
    ______________

    Regards,
    Steven