Skip to main content

I created an action button to create a service order from the customer screen. The customization works great. The only problem is the Address Lookup seemed to stop working. Any Idea what may be causing this?

using PX.Data;
using PX.Objects.CR;
using PX.Objects.FS;
using System.Collections;
using PX.SM;


namespace PX.Objects.AR
{
public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{

public class CustomerServiceOrderDac : IBqlTable{

[PXString(4, IsFixed = true, InputMask = ">AAAA")]
[PXUIField(DisplayName = "Service Order Type", Required = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.NullOrBlank)]
[FSSelectorActiveSrvOrdType]

public virtual string ServiceOrderType{ get; set; }
public abstract class serviceOrderType : PX.Data.BQL.BqlString.Field<serviceOrderType> { }
}

public PXFilter<CustomerServiceOrderDac> pXFilter;

public PXAction<Customer> CreateServiceOrderAction;

[PXButton(CommitChanges = true, DisplayOnMainToolbar = true, Category = "Actions")]

[PXUIField(DisplayName = "Create Service Order", MapViewRights = PXCacheRights.Select, MapEnableRights = PXCacheRights.Update)]


protected virtual IEnumerable createServiceOrderAction(PXAdapter adapter) {

WebDialogResult result = pXFilter.AskExt();

if (result == WebDialogResult.OK){

Customer customer = Base.BAccount.Current;

if (customer == null) return adapter.Get();

var Filter = pXFilter.Current;

if (Filter == null) return adapter.Get();

var serviceOrderEntry = PXGraph.CreateInstance<ServiceOrderEntry>(); //Field Service Graph

if (serviceOrderEntry == null) return adapter.Get();


FSServiceOrder fsServiceOrder = new FSServiceOrder()
{
CustomerID = Base.BAccount.Current.BAccountID,
SrvOrdType = Filter.ServiceOrderType
};

if (fsServiceOrder.SrvOrdType == null)
{
const string ErrorMessage = "Service Order cant be blank";

throw new PXSetPropertyException(ErrorMessage, PXErrorLevel.Error);

}

PXLongOperation.StartOperation(Base, delegate ()
{

fsServiceOrder = serviceOrderEntry.ServiceOrderRecords.Insert(fsServiceOrder);

throw new PXRedirectRequiredException(serviceOrderEntry, null);


});




}
return adapter.Get();
}

public override void Initialize()
{
base.Initialize();

Base.action.AddMenuAction(CreateServiceOrderAction);
}

}

}

the address lookup

 

 

Still not working. I guess there may not be a solution except to not create Action buttons in Acumatica. 


Why does adding a popup dialog to Opportunities prevent the address lookup map from loading?


It’s not just opportunities. It’s any screen with address lookup capability. I’ve put in a case to Acumatica, but since this has been festering for about 4 years, I’m not sure there is a solution except to not use custom action buttons, or not to use the address lookup. 


I haven’t tried that code on any other screen, but I believe the feature is added to each screen in a similar way, so I would suggest it may be a fix on those screens as well.
I also understand that there’s obviously a broken component here that needs to be fixed by Acumatica. However, this was a workaround for a client for whom the Address Lookup was non-negotiable.


I haven’t tried that code on any other screen, but I believe the feature is added to each screen in a similar way, so I would suggest it may be a fix on those screens as well.
I also understand that there’s obviously a broken component here that needs to be fixed by Acumatica. However, this was a workaround for a client for whom the Address Lookup was non-negotiable.

Thanks Daryl. This represents a lot of screens we would need to publish additional customization for to fix a broken process. I’m hopeful that my case with Acumatica gets some attention and a more elegant holistic solution is available. 


I haven’t tried that code on any other screen, but I believe the feature is added to each screen in a similar way, so I would suggest it may be a fix on those screens as well.
I also understand that there’s obviously a broken component here that needs to be fixed by Acumatica. However, this was a workaround for a client for whom the Address Lookup was non-negotiable.

Thanks Daryl. This represents a lot of screens we would need to publish additional customization for to fix a broken process. I’m hopeful that my case with Acumatica gets some attention and a more elegant holistic solution is available. 

Just a quick follow up for others struggling with this. Acumatica says they will not fix the problem.
Due to the transition to new UI technology, functionality related to the customization of ASPX is becoming deprecated, and we do not plan to support it in the future.”

I need to be able to fix this on the Appointment and the Customer screen for my clients who have watched the videos touting the Google address lookup, but I suppose it will have to wait until some future release. 


 


Hi All,

To add more context, the issue seems to happen when we add custom pop-up panel to the screen. @darylbowman suggestion is the possible workaround here. Yes, the issue is being fixed in the new UI. Thanks.!


I believe it’s actually caused by any edits to the UI. This is because when the XML is evaluated, it removes the statements that register the script as an unallowed element. That’s my working theory, since it removes them when I try to add them back.


I believe it’s actually caused by any edits to the UI. This is because when the XML is evaluated, it removes the statements that register the script as an unallowed element. That’s my working theory, since it removes them when I try to add them back.

I can confirm. We have pages with no changes to the action button where this occurs. I’ve fixed it with the extended code, but I’m sure there will be some fly-swatting as users discover other workspaces where it won’t function. 



I need to be able to fix this on the Appointment and the Customer screen for my clients who have watched the videos touting the Google address lookup, but I suppose it will have to wait until some future release. 

I have fixed the customer screen with the following code

using System;
using PX.Data;

namespace PX.Objects.AR
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
#region Fix Address Lookup
public override void Initialize()
{
base.Initialize();

// Add the Page_Load event handler
var page = System.Web.HttpContext.Current?.Handler as PX.Web.UI.PXPage;
if (page is object)
page.Load += Page_Load;
}

// Executes the PXAddressLookup script which is broken by the page customization
private void Page_Load(object sender, EventArgs e)
{
var page = (PX.Web.UI.PXPage)sender;
PX.Objects.CS.PXAddressLookup.RegisterClientScript(page, Base);
}
#endregion
}
}

And appointments using this

using PX.Data;
using System;

namespace PX.Objects.FS
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class AppointmentEntry_Extension : PXGraphExtension<PX.Objects.FS.AppointmentEntry>
{
#region Fix Address Lookup
public override void Initialize()
{
base.Initialize();

// Add the Page_Load event handler
var page = System.Web.HttpContext.Current?.Handler as PX.Web.UI.PXPage;
if (page is object)
page.Load += Page_Load;
}

// Executes the PXAddressLookup script which is broken by the page customization
private void Page_Load(object sender, EventArgs e)
{
var page = (PX.Web.UI.PXPage)sender;
PX.Objects.CS.PXAddressLookup.RegisterClientScript(page, Base);
}
#endregion
}
}

From what I have found, @darylbowman’s code is copy and pastable into any graph extension of screens you are trying to fix. I have fixed these, as well as Sales Orders, Service Orders, and Opportunities without changing any code except the graph extension.


Reply