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?