Question

Populating usrFields from Project Task to Time Activity

  • 30 September 2021
  • 0 replies
  • 82 views

Userlevel 3
Badge

I have been attempting to update 2 Boolean field values on Time Activity based on the same usr fields in the PM-Task Table.  So when a time card has the project Task with “OnSite” Checked or “Travel” Checked it will carry over to the Time Card.  Once created I plan to use this to create fields to match Billable and Total Billable on the Time cards.  I understand that is best done with Event Handlers and maybe this would have been as well.  This is my first time working with Attributes and I have tried to write this a number of ways but somehow I am missing something.  My code is below if anyone has any ideas.

 

PMTask
{
public class PMTaskExt : PXCacheExtension<PX.Objects.PM.PMTask>
{
#region UsrIsOnsite
[PXDBBool]
[PXUIField(DisplayName="IsOnsite")]

public virtual bool? UsrIsOnsite { get; set; }
public abstract class usrIsOnsite : PX.Data.BQL.BqlBool.Field<usrIsOnsite> { }
#endregion

#region UsrIsTravel
[PXDBBool]
[PXUIField(DisplayName="IsTravel")]

public virtual bool? UsrIsTravel { get; set; }
public abstract class usrIsTravel : PX.Data.BQL.BqlBool.Field<usrIsTravel> { }
#endregion
}
}

PMTimeActivity
{
public class PMTimeActivityExt : PXCacheExtension<PX.Objects.CR.PMTimeActivity>
{
#region UsrIsOnsite
[PXDBBool]
[PXUIField(DisplayName="Onsite")]
[PXFormula(typeof(Switch<
Case<Where<
PMTask.taskID, Equal<Current<PMTimeActivity.projectTaskID>>,
And<PMTask.projectID, Equal<Current<PMTimeActivity.projectID>>>>,
PMTaskExt.usrIsOnsite>,
PMTaskExt.usrIsOnsite>))]


public virtual bool? UsrIsOnsite{ get; set; }
public abstract class usrIsOnsite: PX.Data.BQL.BqlBool.Field<usrIsOnsite> { }
#endregion

#region UsrIsTravel
[PXDBBool]
[PXUIField(DisplayName="IsTravel")]
[PXFormula(typeof(PMTaskExt.usrIsTravel))]
[PXFormula(typeof(Switch<
Case<Where<
PMTask.taskID, Equal<Current<PMTimeActivity.projectTaskID>>,
And<PMTask.projectID, Equal<Current<PMTimeActivity.projectID>>>>,
PMTaskExt.usrIsTravel>,
PMTaskExt.usrIsTravel>))]
public virtual bool? UsrIsTravel { get; set; }
public abstract class usrIsTravel : PX.Data.BQL.BqlBool.Field<usrIsTravel> { }
#endregion
}
}

0 replies

Be the first to reply!

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