Search code examples
c#mobileacumatica

Need To Add Custom Action to Acumatica Mobile Application in Appointments


I have been through the Training T400 and T410, but I cannot get this to work in my own application.

I have a custom action that I have added to FS300200. This will call out to an external web application to allow a form to be filled out, which will eventually generate a PDF that gets attached to the appointment.

Custom Action

It is working fine in the web ERP. But I do not know how to get this new button (action) to work in the mobile app.

This is the definition of the action in my custom DLL (slightly stubbed out):

    #region XForm Button
    public PXAction<FSAppointment> asgExtForms;
    [PXUIField(DisplayName = "DoorForm", MapEnableRights = PXCacheRights.Select)]
    [PXButton]
    public virtual void ASGExtForms()
    {
        var allCaches = Base.Caches.Caches;

        /************************************************
         * Code builds full url based on what is found in cache
         ************************************************/
        string fullURL = "SOME VALUE BASED ON CACHE";  

        // Everything is gathered up. Time to send it
        var redirectException =
          new PXRedirectToUrlException(fullURL,
              PXBaseRedirectException.WindowMode.New, "Acumatica.com");
        throw redirectException;  // call URL
        
    }
    #endregion

[EDIT] I have recently tried this code to update the mobile app. It does not give a syntax error, but when I publish it, I do not see any action added to the Mobile screen:

update screen FS300200
  {
  update container "AppointmentRecords"
    {
        update layout "AdditionalTab"
          {
              add layout "ASGLine"
               {
                  add recordActionLink "ASGExtForms"
               }
           }
         add recordAction "ASGExtForms"
          {
            displayName = "DoorForms"
            behavior = Void
          }
    }
 }

[END EDIT]

[ORIGINAL ATTEMPT] In my customization, I am trying to modify the Mobile Application's FS300200:

Customization

This is the mobile markup I am trying:

update screen FS300200
  {
  update container "AppointmentRecords"
    {
        add layout "ASG"
          {
            displayName = "ASG"
            layout = "Tab"
            add group "DoorForms"
            {
              displayName = "DoorForms"
              collapsable = True
              collapsed = True
              add layout "ASGLine"
               {
                  displayName = "WebForm"
                  layout = "Inline"
                  add field "OtherSourceInfoDocumentType#ReferenceNbr"
                  add recordAction "ASGExtForms"
                   {
                     Behavior = Void
                     displayName = "DoorForms"      
                     redirect = True
                   }      
               }
            }
          }
    }
  }

but I get an error:

Line 19: Can't use entity type 'listAction' in current context.

What am I missing?


Solution

  • Just for anyone else trying to do this...

    An action is different than adding other things apparently.

    This is all that was necessary to add it to the screen:

    update screen FS300200
      {
      update container "AppointmentRecords"
        {
        add recordAction "ASGExtForms"
        {
          behavior = void
          redirect = True
        }
        }
     }
    

    Note that the recordAction Name is the same as the value in the DAC, not the Display Name (which is usually what is used. This is different because it is an action...)

      [PXUIField(DisplayName = "DoorForm", MapEnableRights = PXCacheRights.Select)]
        [PXButton]
        public virtual void ASGExtForms()
        {