Skip to main content
Answer

Carry over fields from one screen to another screen

  • July 30, 2025
  • 8 replies
  • 118 views

!--startfragment>

Scenario
We have two screens: the Case screen and the Service Order screen. The goal is to carry over specific field values—Unit and Property—from the Case screen to the Service Order screen.

On the Case screen, these fields are implemented as selectors. When a user clicks either the “Create Service Order” or “View Service Order” action, the Service Order screen opens.

To reflect the same data in the Service Order screen, we’ve added corresponding fields for Unit and Property as read-only text boxes. However, these fields are currently not displaying the values as expected.

I suspect we’re close, but something—likely a missing linkage or binding—is preventing the data from flowing properly (I am new to Acumatica). Here's the code I've implemented so far.  Can anyone help me here ? 

!--endfragment>

  public class FSServiceOrderExt : PXCacheExtension<PX.Objects.FS.FSServiceOrder>
  {
    #region UsrUnitID
    [PXString(255)]
    [PXUIField(DisplayName = "Unit", Visibility = PXUIVisibility.SelectorVisible)]
       [PXDBScalar(typeof(
            Search<Asset.name,
                Where<UnitAsset.unitid, Equal<CaseExt.usrUnitID>,
                    And<Case.caseCD, Equal<Current<ServiceOrder.sourceRefNbr>>>>,
                OrderBy<Asc<UnitAsset.name>>>
        ))]
    public virtual string UsrUnitID { get; set; }
    public abstract class usrUnitID : PX.Data.BQL.BqlString.Field<usrUnitID> { }
    #endregion

    #region UsrAssetID
    [PXString(255)]
    [PXUIField(DisplayName = "Property", Visibility = PXUIVisibility.SelectorVisible)]
            [PXDBScalar(typeof(
            Search<UnitAsset.assetID,
                Where<UnitAsset.assetCD, Equal<CaseExt.usrAssetID>,
                    And<Case.caseCD, Equal<Current<ServiceOrder.sourceRefNbr>>>>,
                OrderBy<Asc<UnitAsset.assetCD>>>
        ))]
    public virtual string UsrAssetID { get; set; }
    public abstract class usrAssetID : PX.Data.BQL.BqlString.Field<usrAssetID> { }
    #endregion
  }

 

Best answer by DrewNisley

I apologize, I didn’t catch that these are unbound fields. The following should work if you just want to reference the original value of your cache extension.

[PXFormula(typeof(Search<CRCaseExtCustom.usrUnitID, Where<CRCase.caseCD, Equal<Current<FSServiceOrder.sourceRefNbr>>>>))]

 

8 replies

DrewNisley
Pro I
Forum|alt.badge.img+3
  • Pro I
  • July 30, 2025

You have the fields created, but you have to give them logic so that it actually transfers over. I would override the UpdateServiceOrderHeader method from within the Create Service Order button to transfer your fields. Use the below extension to override it.

public class SM_CRCaseMaintExt : PXGraphExtension<SM_CRCaseMaint, CRCaseMaint>
{
public static bool IsActive() => PXAccess.FeatureInstalled<FeaturesSet.serviceManagementModule>();

public delegate void UpdateServiceOrderHeaderDelegate(ServiceOrderEntry graphServiceOrderEntry, PXCache cache, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow, FSServiceOrder fsServiceOrderRow, bool updatingExistingSO);

[PXOverride]
public virtual void UpdateServiceOrderHeader(ServiceOrderEntry graphServiceOrderEntry, PXCache cache, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow, FSServiceOrder fsServiceOrderRow, bool updatingExistingSO, UpdateServiceOrderHeaderDelegate baseMethod)
{
baseMethod(graphServiceOrderEntry, cache, crCaseRow, fsCreateServiceOrderOnCaseFilterRow, fsServiceOrderRow, updatingExistingSO);

//Do your changes here

graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
}
}

 


  • Author
  • Freshman I
  • July 31, 2025

Thank you 😊 DrewNisley for your quick response. I have followed you but values are not showing up.
public class CRCaseMaint_Extension : PXGraphExtension<SM_CRCaseMaint, CRCaseMaint>
{
  public static bool IsActive() => PXAccess.FeatureInstalled<FeaturesSet.serviceManagementModule>();

    public delegate void UpdateServiceOrderHeaderDelegate(
        ServiceOrderEntry graphServiceOrderEntry,
        PXCache cache,
        CRCase crCaseRow,
        FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow,
        FSServiceOrder fsServiceOrderRow,
        bool updatingExistingSO);

    [PXOverride]
    public virtual void UpdateServiceOrderHeader(
        ServiceOrderEntry graphServiceOrderEntry,
        PXCache cache,
        CRCase crCaseRow,
        FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow,
        FSServiceOrder fsServiceOrderRow,
        bool updatingExistingSO,
        UpdateServiceOrderHeaderDelegate baseMethod)
    {     baseMethod(graphServiceOrderEntry, cache, crCaseRow, fsCreateServiceOrderOnCaseFilterRow, fsServiceOrderRow, updatingExistingSO);
        var caseExt = PXCache<CRCase>.GetExtension<CRCaseExtCustom>(crCaseRow);
        var soExt = PXCache<FSServiceOrder>.GetExtension<FSServiceOrderExt>(fsServiceOrderRow);
        if (caseExt != null && soExt != null)
        {
            // Copy custom fields
            soExt.UsrUnitID = caseExt.UsrUnitID;
            soExt.UsrAssetID = caseExt.UsrAssetID;
            graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
        }
    }
}

Can’t we update the fields using sql query instead of code like this and update the action fields in tabs(in field update and action parameters). I tried but didn’t work.
  [PXString(255)]
    [PXUIField(DisplayName = "Unit", Visibility = PXUIVisibility.SelectorVisible)]
       [PXDBScalar(typeof(
            Search<Asset.name,
                Where<UnitAsset.unitid, Equal<CaseExt.usrUnitID>,
                    And<Case.caseCD, Equal<Current<ServiceOrder.sourceRefNbr>>>>,
                OrderBy<Asc<UnitAsset.name>>>
        ))]

 

 


Forum|alt.badge.img+1
  • Jr Varsity I
  • July 31, 2025


        if (caseExt != null && soExt != null)
        {
            // Copy custom fields
            soExt.UsrUnitID = caseExt.UsrUnitID;
            soExt.UsrAssetID = caseExt.UsrAssetID;
            graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
        }
   

 

Did you test saving after updating your field values?

Also your pxdbscalar looks like it is not right, you are referencing 3 DACs besides the DAC your field is on (Asset, UnitAsset, and Case), so if you were trying to use this method you would at least need a join to Case


Forum|alt.badge.img+7
  • Captain II
  • July 31, 2025

The fields are set up as non-persisted fields so there’s nothing to save.

The DBScalar formula is incorrect as ​@Josiah Lisle mentioned. It’s very much a sub-select statement in a SQL query so your joins between the three DAC (tables) needs to be in place.


DrewNisley
Pro I
Forum|alt.badge.img+3
  • Pro I
  • Answer
  • July 31, 2025

I apologize, I didn’t catch that these are unbound fields. The following should work if you just want to reference the original value of your cache extension.

[PXFormula(typeof(Search<CRCaseExtCustom.usrUnitID, Where<CRCase.caseCD, Equal<Current<FSServiceOrder.sourceRefNbr>>>>))]

 


  • Author
  • Freshman I
  • July 31, 2025

got you ​@Josiah Lisle ​@Django I tried this. 

[PXUIField(DisplayName = "Prop", Enabled = false)]

[PXDefault(typeof(Search<

    OwnerUnitAsset.assetCD,

    InnerJoin<CRCase, On<CRCaseExt.usrAssetID, Equal<OnniDACs.OwnerUnitAsset.assetID>>>,

    Where<CRCase.caseCD, Equal<Current<FSServiceOrder.sourceRefNbr>>>

>))]


DrewNisley
Pro I
Forum|alt.badge.img+3
  • Pro I
  • August 1, 2025

@pkumari Is there a reason as to why you are trying to pull in all these other DACs instead ot just referencing the original Case cache extension value?


  • Author
  • Freshman I
  • August 1, 2025

@DrewNisley I was retrieving the unitname(string) associated with a specific unitId(int). For example, given unitId 123, I needed to obtain its corresponding unit name, such as 'happy'. To achieve this, I relied on additional DACs, particularly the OwnerUnitAsset DAC.
However, thanks to your query, I was able to resolve the issue by incorporating the Graph Extension-ServiceOrderEntry.

 public class ServiceOrderEntry_Extension : PXGraphExtension<PX.Objects.FS.ServiceOrderEntry>
 {
  protected void FSServiceOrder_UsrUnitID_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
    PXUIFieldAttribute.SetVisible<FSServiceOrderExt.usrUnitID>(sender, null, true);
}
protected void FSServiceOrder_UsrAssetID_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
    PXUIFieldAttribute.SetVisible<FSServiceOrderExt.usrAssetID>(sender, null, true);
}  
protected void FSServiceOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
    var row = e.Row as FSServiceOrder;
    if (row == null || row.SourceRefNbr == null)
        return;

    var extOrder = PXCache<FSServiceOrder>.GetExtension<FSServiceOrderExt>(row);

    // Prevent repeated assignment
    if (extOrder.UsrUnitID != null && extOrder.UsrAssetID != null)
        return;

    var caseRecord = PXSelect<CRCase,
        Where<CRCase.caseCD, Equal<Required<CRCase.caseCD>>>>
        .Select(Base, row.SourceRefNbr);

    if (caseRecord != null)
    {
        var extCase = PXCache<CRCase>.GetExtension<CRCaseExtCustom>(caseRecord);

        if (extOrder.UsrUnitID == null && extCase.UsrUnitID != null)
            sender.SetValueExt<FSServiceOrderExt.usrUnitID>(row, extCase.UsrUnitID);

        if (extOrder.UsrAssetID == null && extCase.UsrAssetID != null)
            sender.SetValueExt<FSServiceOrderExt.usrAssetID>(row, extCase.UsrAssetID);
    }
}!--endfragment>!--startfragment>

}

Thanks a lot for helping me out :) ​@DrewNisley@Josiah Lisle ​@Django