Skip to main content

Hi Guys, I’m trying to add custom column - contract Price field from service contract and display in run service contract billing screen.

I added the field in Screen editor customization. created the DAC, and graph but I’m not able to view the data in run service contract billing screen.

Below is my custom field.

 

DAC,

#region UsrContractTotal

        PXDBDecimal]
        /PXUIField(DisplayName = "Contract Price")]
        public virtual decimal? UsrContractTotal { get; set; }
        public abstract class usrContractTotal : BqlDecimal.Field<usrContractTotal> { }
        #endregion

Graph,

Public class ContractPeriodToPostEntryExt : PXGraphExtension<CreateInvoiceByContractPost>
    {
        #region Event Handlers
        public static bool IsActive() => true;
        protected virtual void ContractPeriodToPost_ServiceContractID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            var row = (ContractPeriodToPost)e.Row;
            if (row != null)
            {

                PXResultset<FSContractPeriodDet> objservicecont = PXSelectJoin<FSContractPeriodDet,
                                               InnerJoin<FSContractPeriod,
                                                        On<FSContractPeriod.serviceContractID, Equal<FSContractPeriodDet.serviceContractID>,
                                                           And<FSContractPeriod.contractPeriodID, Equal<FSContractPeriodDet.contractPeriodID>>>>,
                                               Where<FSContractPeriodDet.serviceContractID, Equal<Required<FSServiceContract.serviceContractID>>,
                                                     And<FSContractPeriod.status, Equal<FSContractPeriod.status.Active>>>>.Select(Base, row.ServiceContractID);

                decimal totalRecSum = 0m;
                foreach (var det in objservicecont)
                {
                    totalRecSum += ((FSContractPeriodDet)detr0]).RecurringTotalPrice ?? 0m;
                }
                row.GetExtension<ContractPeriodToPostKSExt>().UsrContractTotal = totalRecSum;
            }
        }
    }
}
#endregion

When i try to debug, I’m able to get the data in graph but not in the UI. Can anyone check where it is going wrong. 

For some reason I was not able to share my customization.

Hi @mice As you are using the FieldSelecting event, if you assign like below it may not populate the value.

 row.GetExtension<ContractPeriodToPostKSExt>().UsrContractTotal = totalRecSum;

There is minor you need to populate the value properly. Try below code instead of above code.

e.ReturnValue = totalRecSum;


@Naveen Boga, still same result - its empty.

 

 


@mice   Please use below code and check.

Also, you need to change the EVENT  like - ContractPeriodToPost_UsrContractTotal_FieldSelecting


 

protected virtual void ContractPeriodToPost_UsrContractTotal_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (ContractPeriodToPost)e.Row;
if (row != null)
{

PXResultset<FSContractPeriodDet> objservicecont = PXSelectJoin<FSContractPeriodDet,
InnerJoin<FSContractPeriod,
On<FSContractPeriod.serviceContractID, Equal<FSContractPeriodDet.serviceContractID>,
And<FSContractPeriod.contractPeriodID, Equal<FSContractPeriodDet.contractPeriodID>>>>,
Where<FSContractPeriodDet.serviceContractID, Equal<Required<FSServiceContract.serviceContractID>>,
And<FSContractPeriod.status, Equal<FSContractPeriod.status.Active>>>>.Select(Base, row.ServiceContractID);

decimal totalRecSum = 0m;
foreach (var det in objservicecont)
{
totalRecSum += ((FSContractPeriodDet)dett0]).RecurringTotalPrice ?? 0m;
}
e.RetunValue = totalRecSum;
}
}
}
}

 


You are a STAR of Acumatica @Naveen Boga ...


@mice  I’m glad that I helped you and Thank you!!


Reply