Solved

Cannot get my Custom action to display in Mobile Application

  • 7 April 2023
  • 3 replies
  • 198 views

Userlevel 4
Badge

 

I have been through the Training T400 and T410, but I cannot get this to work in my own application. I have looked at some of the related topics on here, and in StackOverflow, and nothing I try seems to work.

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.

This works fine from within the Web Page: 

 

In the custom DLL, the source code looks like this:

#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 fuill 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

 

When I look at the web service, and examine the WSDL, I see that it is in the actions:

 

  <ASGExtForms>            <ViewTypeName>string</ViewTypeName>  </ASGExtForms>

But I cannot seem to figure out how to add this to the mobile.

I have tried several things to add this to the Appointment screen in Mobile. Ideally. I’d like a button in the Additional Tab that said: “Door Forms” and in that would be a button that did the call out action to the external form application. 

Based on an answer I saw on here, I have tried this: 

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

 

That did not give me any errors. But it does not display the new layout or link, either.

It DOES modify the screen. I see this in the screen preview now: 

      add containerLink "Attributes"
      add layout "ASGLine" 
      {
        displayName = "ASGLine"
        add recordActionLink "ASGExtForms"
      }
And also I see this: 

    add recordAction "ASGExtForms" {
      displayName = "DoorForms"
      behavior = Void
    }
    attachments {
    }
But I see nothing in the Appointments Additional Tab:

Android App Screenshot

I must be missing something simple… but what?

TIA!

 

 

 

icon

Best answer by Cesar Betances 14 April 2023, 22:04

View original

3 replies

Userlevel 4
Badge +2

Hi @mjgrice32 ,

 

Please note when mapping elements to a Mobile screen (via MSDL code) you must use the proper element name. In order to locate the proper element name you need to review the WSDL Schema of the target screen. See more details: https://help.acumatica.com/Help?ScreenId=ShowWiki&pageid=53dc4043-f69c-42f7-a235-384fb0629fa3

 

Looking at your code snippet the action name would most likely be something like: “DoorForms” instead of “ASGExtForms”. The reason for this assumption is that WSDL generally takes the name from the UI label (you still should confirm in the WSDL Schema to be certain).

 

You can also take a look at this post for mapping action that redirects to an external URL:

https://stackoverflow.com/questions/53072032/using-the-existing-redirection-to-an-external-url

 

Hope this helps.

Userlevel 4
Badge

Cesar,

Thank you for the reply, I appreciate it. 

I am still having trouble following the instructions you gave me, however, and I was hoping got some clarification.

First, when I check the WSDL, the only thing I find about my customization is the action definition itself: 

In the <Actions> section, there is simply: 

          <ASGExtForms>            <ViewTypeName>string</ViewTypeName>          </ASGExtForms>However, as you say, in my Code the display name is declared: 

        public PXAction<CROpportunity> asgExtForms;
        [PXUIField(DisplayName = "DoorForms", MapEnableRights = PXCacheRights.Select)]
        [PXButton]
        public virtual void ASGExtForms()
        {
 

This makes it hard for be to understand what the mobile app is expecting. 

Also, the one thing that is very confusing to me is that the code to update the mobile script is not the same as the PREVIEW script shown. 

This is my understanding, please correct me where I am wrong.

The Customization Project Editor is simply a controlled way of editing the Mobile app’s XML definitions. In order to add an action to the Mobile application, first, I select the screen I will modify, then I either select an existing container to modify, or I add a new one. In my case, I am updating an existing one:

 update container "AppointmentRecords"
    {
        update layout "AdditionalTab"
          {

 

Is updating the Additional Tab container (section) in the AppointmentRecords screen. 

The additional Tab currently has five lines in it. I want to add a sixth. This is what it looks like now: 

 

Mobile App

 

In order to add to this screen, I need to include instructions to add a new layout (I am calling it ASGLine) and within that new layoutm, I add a record action Link to “DoorForm”

So I put: 

add layout "ASGLine"
               {
                  add recordActionLink "DoorForm"
               }

So, that should create the UI for the link. The action should apply to the currently selected record. Which I think is what I want. But -- the action itself needs to be defined (which is what the link will call to ) so I have this as well: 

 

         add recordAction "DoorForm"
          {
            displayName = "DoorForms"
            behavior = Void
          }

 

So, to my mind that is all I need? But it still does not display the DoorForms link. What am I missing?

I don’t know if this matters but when I look at my SCREEN customization in the Customization editor, I see the action exists, but no attributes seem to be changed. IDK if that matters or not:

Can anyone provide further guidance?

 

 

 

Userlevel 4
Badge

FWIW, the issue seems to be that actions are handled differently than fields when adding them to the mobile app.

Here was the final solution for me (which was actually simple once I knew what to look for). (Note that the 

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

 

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

The C# code snippet looks like this:

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

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved