Skip to main content

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
sPXDBBool]
oPXUIField(DisplayName="IsOnsite")]

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

#region UsrIsTravel
aPXDBBool]
oPXUIField(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
sPXDBBool]
oPXUIField(DisplayName="Onsite")]
ePXFormula(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
aPXDBBool]
oPXUIField(DisplayName="IsTravel")]
lPXFormula(typeof(PMTaskExt.usrIsTravel))]
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
}
}
Be the first to reply!

Reply