首页 > 解决方案 > 如何向移动应用程序添加新操作

问题描述

再会

构建 20.107.0026

我创建了一个新操作并希望将其添加到我的移动应用程序中。是否可以向移动屏幕添加自定义操作?我在约会屏幕中创建了以下操作(FS300200)

namespace PX.Objects.FS
{
    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    public class AppointmentEntry_Extension : PXGraphExtension<AppointmentEntry>
  {
    #region Event Handlers

    public PXAction<PX.Objects.FS.FSAppointment> DoWork;
  
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "DoWork")]
    protected void doWork()
    {

    }

    #endregion
  }
}

手机代码如下。如果我想将按钮添加到主菜单;侧面的 3 个点我使用 AppointmentRecords 作为容器吗?

update screen FS300200 {
  update container "AppointmentRecords" {
     add listAction "StartTravelAPICall" {
        behavior = Void
        displayName = "StartTravelAPICall"
      }
  }
}

标签: acumatica

解决方案


The short answer is YES! The long answer depends in part on what version of Acumatica you are using. For the purpose of this answer, I'll assume you are in 2019R2 and already know how to add or edit a Mobile App screen in Acumatica. If not, the training guides referenced below should give you all the detailed information you need to accomplish your goal.

Manipulating the Mobile App screens/actions is relatively easy if the screen/action works in the browser interface. The T410 course material explains how to add an action in 2019R2. I don't work with Field Services, so I'll have to explain more generically as per the training guide.

First you must either add or edit the screen in the Mobile Application section of the Customization Project. (In your case, you want to Update the existing screen.) This will create a section of code in the customization project that looks like this: enter image description here

As you can see, the original screen definition in the mobile app is shown on the right, and you will be updating the screen to add your action. You will need to add the appropriate container (not shown in your question) and then the action within that container.

To continue the answer, let's switch to the training guide example on page 12 of the T410 course updating the SO303000 screen. You can compare to your screen to see what needs to be changed.

add container "InvoiceSummary" {
  # fields declaration
  …
  add recordAction "Save" {
    behavior = Save
  }
  add recordAction "Cancel" {
    behavior = Cancel
  }
  add containerAction "Insert" {
    behavior = Create
  }
  add recordAction "ReleaseAction" {
    syncLongOperation = true
    behavior = Record
  }
}

I believe your action would follow the ReleaseAction portion at the bottom of the example, and the need for syngLongOperation = true would depend on what your action is doing (i.e. if you need the action performed asynchronously).

Assuming your container is already defined in the page, which I suspect it is, let's instead look at the example for PO302000 on page 35. This example shows how to UPDATE a container to add your action.

update screen PO302000 {
  update container "DocumentSummary" {
    add recordAction "AddPOOrderLine" {
      displayName = "Add PO Line"
      behavior = Void
      redirect = True
      redirectToContainer = "AddPurchaseOrderLine$List"
    }
  }
}

That was a more complex action, but yours may be as simple as.

update screen FS300200 {
  update container "ServiceOrderTypeLine" {
    add listAction "DoWork" {
      Behavior = Void
      displayName = "Do Work"
    }
  }
}

If you need guidance on how to read the WDSL Schema to identify the container, etc. that training is found in T400 starting on Page 13.

I highly recommend reviewing both T400 and T410 if you are working with the mobile app as there is a lot more detail in those training guides than can be explained easily in a Stack Overflow post/answer.


推荐阅读