Good day
I please need some help in adding a new column to the Employee Time page.
The field would show the customers name next to the product that it is linked to, the project displays on the grid by default.
At the moment I cannot seem to add an additional column to the grid, I added it via a customization and the field does show in the customization project but when previewing the page the column is not in the grid
Please assist me with this
Solved
Adding a new column to a grid
Best answer by Naveen Boga
Hi,
You want to add a new field i.e. Customer after the project. Please find the sample code and attached screenshot for your reference.
Hope this helps!!
public class EPTimeCardSummaryWithInfoExt : PXCacheExtension<EPTimeCardSummaryWithInfo>
{
[CustomerActive(
typeof(Search<BAccountR.bAccountID, Where<True, Equal<True>>>),
Visibility = PXUIVisibility.SelectorVisible,
DescriptionField = typeof(Customer.acctName),
Filterable = true)]
[PXUIField(DisplayName = "Customer ID")]
public int? UsrCustomerID { get; set; }
public abstract class usrCustomerID : PX.Data.BQL.BqlInt.Field<usrCustomerID> { }
}
public class TimeCardMaintExt : PXGraphExtension<TimeCardMaint>
{
protected virtual void EPTimeCardSummaryWithInfo_ProjectID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(sender, e);
EPTimeCardSummaryWithInfo row = (EPTimeCardSummaryWithInfo)e.Row;
if (row != null)
{
PMProject objPMProject = PXSelect<PMProject, Where<PMProject.contractID, Equal<Required<PMProject.contractID>>>>.Select(Base, row.ProjectID);
if (objPMProject != null)
{
row.GetExtension<EPTimeCardSummaryWithInfoExt>().UsrCustomerID = objPMProject.CustomerID;
}
}
}
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.