Solved

Adding hyperlink to grid gives disabled error

  • 6 May 2022
  • 1 reply
  • 143 views

Userlevel 7
Badge +5

I have added a view (ContractDetails) in a BusinessAccountMaint extension.  One of the columns contains a Vendor Number and I would like to add a hyperlink on that column to make the related vendor number appear in a popup window.  The Vendor Number column is defined as follows, it is just a lookup field.


#region UsrVendor
[PXString(15)]
[PXUIField(DisplayName="Vendor", Enabled=false)]
[PXDBScalar(typeof(Search2<BAccount.acctCD
,InnerJoin<POVendorInventory, On<POVendorInventory.vendorID, Equal<BAccount.bAccountID>>
,InnerJoin<ContractItem, On<ContractItem.recurringItemID, Equal<POVendorInventory.inventoryID>>>>
,Where<ContractItem.contractItemID, Equal<ContractDetail.contractItemID>>
>)
)]

public virtual string UsrVendor { get; set; }
public abstract class usrVendor : PX.Data.BQL.BqlString.Field<usrVendor> { }
#endregion

Here is my code for the hyperlink and popup window. I’ve added ViewVendor in the column’s LinkCommand.

    public PXAction<Vendor> ViewVendor;
[PXUIField(DisplayName = "", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = true, Visible = false)]
[PXEditDetailButton]
public virtual IEnumerable viewVendor(PXAdapter adapter)
{


if (ContractDetails.Current != null)
{
ContractDetailExt contractDetailExt = ContractDetails.Current.GetExtension<ContractDetailExt>();

VendorMaint docgraph = PXGraph.CreateInstance<VendorMaint>();

docgraph.CurrentVendor.Current = Vendor.UK.Find(docgraph, contractDetailExt.UsrVendor);

if (docgraph.CurrentVendor.Current != null)
{
throw new PXRedirectRequiredException(docgraph, true, "Vendors") { Mode = PXBaseRedirectException.WindowMode.NewWindow };
}

}
return adapter.Get();
}

However, when I click on the Vendor # I get a message:

Error: The View Vendor button is disabled.

And based on PXTrace messages, none of the code is being run.

What might I be missing?

icon

Best answer by Shawn Burt 6 May 2022, 00:40

View original

1 reply

Userlevel 5
Badge +1

what is the primary view of the screen in question?

normally the pxaction is set to match, e.g. even if it is used to view a Vendor that doesn’t mean the declare is <Vendor> it should be the primary view type of the graph. 

Also not sure what [PXEditDetailButton] attribute is, but it could be setting the button to disabled.

you might use PXButton instead.

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