SBX - Search With Button

SBX - Forum Post Title

I got Action in page extension -Reference to symbol 'Release' is ambiguous.

Microsoft Dynamics NAV Forum

RuviniPe asked a question on 6 Dec 2018 3:33 AM

Question Status

Suggested Answer

Hi,

I wanted to add a new field Status RPE in Purchase header Table and update this field when Release and Reopen actions are clicked.

So used code In AL

I could write for Reopen Action but not for Release . May I knoe how to solve this.

Thanks

Ruvini.

Reply
Suggested Answer

I cannot see your code (image is broken?) but you can create an event subscriber to the OnAfterValidate of the Purchase Header's Status field and act accordingly.

Reply
RuviniPe responded on 6 Dec 2018 4:08 AM

My code is

actions

   {    

       modify(Reopen)

       {

          trigger OnAfterAction();

          begin

               PurchaseOrderRec.GET("Document Type", "No.");  

               PurchaseOrderRec."Status RPE":= true;

               PurchaseOrderRec.MODIFY;        

          end;

       }

       modify(Release)

       {

           trigger OnAfterAction();

          begin

               PurchaseOrderRec.GET("Document Type", "No.");  

               PurchaseOrderRec."Status RPE":= false;

               PurchaseOrderRec.MODIFY;                            

          end;

       }

   }

Reply
RuviniPe responded on 6 Dec 2018 10:46 PM

Can you tell me how to do

what I try is this

actions

  {    

      modify(Reopen)

      {

         trigger OnAfterAction();

         begin

              PurchaseOrderRec.GET("Document Type", "No.");  

              PurchaseOrderRec."Status RPE":= true;

              PurchaseOrderRec.MODIFY;        

         end;

      }

      modify(Release)

      {

          trigger OnAfterAction();

         begin

              PurchaseOrderRec.GET("Document Type", "No.");  

              PurchaseOrderRec."Status RPE":= false;

              PurchaseOrderRec.MODIFY;                            

         end;

      }

  }

But cannot use Release.Reopen works fine

Reply
Suggested Answer

Why you write a code in the OnAfterAction event? It's not so good writing a code in a page extension.

My suggestion is to subscribe the OnAfterValidate event of the Status field and then here write your code by checking the status:

if Status = Status::Released then

 //...

else

 //...

Reply
Kishor T responded on 7 Dec 2018 3:49 AM

OnAfterGetRecord( ) and OnModifyRecord( )  Wright on below code 

IF REC.Status = Status::Released then Begin

   IF PurchaseOrderRec.GET("Document Type", "No.") Then Begin

    PurchaseOrderRec."Status RPE":= true;

    PurchaseOrderRec.MODIFY;

END;      

END ELSE Begin

  IF   PurchaseOrderRec.GET("Document Type", "No.") Then Begin

      PurchaseOrderRec."Status RPE":= False;

      PurchaseOrderRec.MODIFY; 

END;

END;  

(or)

 Wright code in Release and Reopen button.

Reply
Suggested Answer

I cannot see your code (image is broken?) but you can create an event subscriber to the OnAfterValidate of the Purchase Header's Status field and act accordingly.

Reply
Suggested Answer

Why you write a code in the OnAfterAction event? It's not so good writing a code in a page extension.

My suggestion is to subscribe the OnAfterValidate event of the Status field and then here write your code by checking the status:

if Status = Status::Released then

 //...

else

 //...

Reply

SBX - Two Col Forum

SBX - Migrated JS