Options

when value is changed after sales order reopened?

gadzilla1gadzilla1 Member Posts: 316
I'm stuck on the following:

I've created a boolean value in the sales lines table that is set to be unchecked initially.

If the value is checked (True) by the user, and the sales order is released, I'd like to set up a message that appears when the order is reopened and the user attempts to uncheck this value.

Does anyone have any ideas on how to do this? Any help is much appreciated.

I understand how to create messages, I'm having problems with the order status and changed values. :?

Thanks! gad1

Answers

  • Options
    ufukufuk Member Posts: 514
    I didn't exactly understood but I assume that you let the user check the sales line field when order status is released and you want to show a message when it is reopened or he unchecks the field. If not like this you can change status etc. below. Basically:

    On sales header, you can use OnValidate of Status field. You can query rec and xrec and if the status is as you want (like open) you can make a relation with the sales line (using get with doc type and doc no). (If your fields are not validated you have to use Validate(Field,Value) instead of assignment(Field := Value).
    IF xRec.Status <> Rec.Status THEN
      IF Status = Status::Open THEN
        IF SalesLine.GET("Document Type","No.") THEN
          IF (NOT) SalesLine.YourField THEN
            MESSAGE();
    

    On sales line you can use OnValidate of your Boolean field. It is the same as header. This time you reverse the status code line and the your boolean field code line.

    If not clear, pls let me know.

    Regards.
    Ufuk Asci
    Pargesoft
  • Options
    gadzilla1gadzilla1 Member Posts: 316
    Thanks ufuk. I see exactly what I left out.

    I'll try this at work today. I'll reply with an update in a bit after I implement and test.

    Have a great day - gad1
  • Options
    gadzilla1gadzilla1 Member Posts: 316
    Ufuk,

    Could you please show me the following?

    "This time you reverse the status code line and the your boolean field code line..."

    I'd like to change only the Sales Line if possible and leave the Sales Header be.

    Thanks much - gad1
  • Options
    gadzilla1gadzilla1 Member Posts: 316
    Another thing too in regards to your initial reply.

    You stated "you want to show a message when it is reopened or he unchecks the field."

    I want to accomplish "you want to show a message when it is reopened AND he unchecks the field."

    Thank you very much for any assistance!

    gad1
  • Options
    ufukufuk Member Posts: 514
    You can use OnValidate of your field like:
    IF xRec.YourField <> YourField THEN
      IF NOT YourField THEN
        IF SalesHeader.GET("Document Type","Document No.") THEN
          IF SalesHeader.Status = SalesHeader.Status::Open  THEN
            MESSAGE();
    

    Regards.

    Ufuk
    Ufuk Asci
    Pargesoft
  • Options
    gadzilla1gadzilla1 Member Posts: 316
    This works perfectly, thank you!

    I will put 'solved' in the subject.

    Take care - gad1
Sign In or Register to comment.