Skip to main content
Answer

Cannot figure out how to get DAC Extension info on Time Card Entry screen

  • December 22, 2022
  • 1 reply
  • 150 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I added UDFs to the EP305000 screen in the Details Tab.  You can see here that the data is saving to the DB as expected. (Customer, MEP ID, Advisor ID, Product Line ID)

I want to take the data after the hyphen in the Customer number field and put it into the Plan ID UDF.

When I added the fields, it created a DAC Extension in PMTimeActivity.

In the Project Editor, if I choose to add a handler on the Field Updated event for the Customer field,

 

It creates a graph Extension as here:

So, the DAC extension is as follows as 

public class PMTimeActivityExt : PXCacheExtension<PX.Objects.CR.PMTimeActivity>

but the graph extension is 

public class TimeCardMaint_Extension : PXGraphExtension<TimeCardMaint>

This obviously won’t compile as the cache is not PMTimeActivity, but rather it is EPTimecardDetail.

PMTimeActivityExt myExt = PXCache<EPTimecardDetail>.GetExtension<PMTimeActivityExt>(row);

How can I get a reference to the DAC Extension when the cache is different from what the graph is showing the cache should be?

Best answer by Joe Schmucker

I figured it out.

 

        protected void EPTimecardDetail_UsrCustomerID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            var row = (EPTimecardDetail)e.Row;

            PMTimeActivity tcd = SelectFrom<PMTimeActivity>.Where<PMTimeActivity.noteID.IsEqual<@P.AsGuid>>.View.Select(Base, row.RefNoteID);
            PMTimeActivityExt myExt = PXCache<PMTimeActivity>.GetExtension<PMTimeActivityExt>(tcd);

            cache.SetValue<PMTimeActivityExt.usrPlanID>(row, "TEST");
        }

1 reply

Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • Answer
  • December 23, 2022

I figured it out.

 

        protected void EPTimecardDetail_UsrCustomerID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            var row = (EPTimecardDetail)e.Row;

            PMTimeActivity tcd = SelectFrom<PMTimeActivity>.Where<PMTimeActivity.noteID.IsEqual<@P.AsGuid>>.View.Select(Base, row.RefNoteID);
            PMTimeActivityExt myExt = PXCache<PMTimeActivity>.GetExtension<PMTimeActivityExt>(tcd);

            cache.SetValue<PMTimeActivityExt.usrPlanID>(row, "TEST");
        }