Skip to main content
Solved

Sales Order Details UnitCost or AverageCost on Mobile App


I am trying to add the Unit Cost, Average Cost, and a custom field Kit Unit Cost to the Sales Order Details container in the mobile app. Here is my code to do this:

update screen SO301000 {
  update container "Details" {
    add layout "LineCostRow" {
      displayName = "LineCostRow"
      layout = "Inline"
      add field "UnitCost"
      add field "KitUnitCost"
      add field "AverageCost"
      placeBefore group "LinePriceGroup"
    }
  }
}

This only added my custom field Kit Unit Cost (Shown in image below):

 

I tried simplifying my code to this:

update screen SO301000 {  
  update container "Details" {
    add field "UnitCost"
    add field "KitUnitCost"
    add field "AverageCost"
  }
}

And the only field displayed is my custom field as well, just at the bottom of the container. I’ve confirmed the field names using the WSDL Schema as shown in image below:

Any suggestions on how to get either Average Cost or Unit Cost to show up on the details tab of the Sales Order? Am I missing something? Any help would be greatly appreciated!

Best answer by harutyungevorgyan

Hello ​@jroush82 ,
Regarding the KitUnitCost field—I'm not familiar with it, and I couldn’t find such a field in my Sales Demo data under SO. It might be a custom field or perhaps related to a specific feature that needs to be enabled. Could you confirm that?

As for the other two fields, I can definitely help you with those.

The issue is straightforward: Both fields are simply not visible. The AverageCost field has its Visible property set to false in the [PXUIField] attribute, and the UnitCost field (which appears as CuryUnitCost in the mobile UI) is being hidden by some business logic within Acumatica.

To fix this, you can:

  1. Create a CacheAttached event for the AvgCost field and remove the Visible = false.

  2. Add logic to set Visible = true for the CuryUnitCost field when the request is coming from the mobile app.

Here’s the code I used for the mobile UI:

update screen SO301000 {
  update container "Details" {
      add layout "LineCostRow" {
        displayName = "LineCostRow"
        layout = "Inline"
        placeBefore group "LinePriceGroup"
        add field "AverageCost"
        add field "UnitCost"
      }
    }
  }

And these are the events:

[PXRemoveBaseAttribute(typeof(PXUIFieldAttribute))]
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIField(DisplayName = "Average Cost", Enabled = false)]
public virtual void _(Events.CacheAttached<SOLine.avgCost> e) { }

public virtual void _(Events.RowSelected<SOLine> e)
{
  if (Base.IsMobile)
   {
     PXUIFieldAttribute.SetVisible<SOLine.curyUnitCost>(e.Cache, e.Row);
   }
}

This is what it looks like:


Let me know if this solves your issue!
In addition, I believe you’ll like the attached package that includes all these changes 🙂

View original
Did this topic help you find an answer to your question?

3 replies

harutyungevorgyan
Jr Varsity I
Forum|alt.badge.img+1

Hello ​@jroush82 ,
Regarding the KitUnitCost field—I'm not familiar with it, and I couldn’t find such a field in my Sales Demo data under SO. It might be a custom field or perhaps related to a specific feature that needs to be enabled. Could you confirm that?

As for the other two fields, I can definitely help you with those.

The issue is straightforward: Both fields are simply not visible. The AverageCost field has its Visible property set to false in the [PXUIField] attribute, and the UnitCost field (which appears as CuryUnitCost in the mobile UI) is being hidden by some business logic within Acumatica.

To fix this, you can:

  1. Create a CacheAttached event for the AvgCost field and remove the Visible = false.

  2. Add logic to set Visible = true for the CuryUnitCost field when the request is coming from the mobile app.

Here’s the code I used for the mobile UI:

update screen SO301000 {
  update container "Details" {
      add layout "LineCostRow" {
        displayName = "LineCostRow"
        layout = "Inline"
        placeBefore group "LinePriceGroup"
        add field "AverageCost"
        add field "UnitCost"
      }
    }
  }

And these are the events:

[PXRemoveBaseAttribute(typeof(PXUIFieldAttribute))]
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIField(DisplayName = "Average Cost", Enabled = false)]
public virtual void _(Events.CacheAttached<SOLine.avgCost> e) { }

public virtual void _(Events.RowSelected<SOLine> e)
{
  if (Base.IsMobile)
   {
     PXUIFieldAttribute.SetVisible<SOLine.curyUnitCost>(e.Cache, e.Row);
   }
}

This is what it looks like:


Let me know if this solves your issue!
In addition, I believe you’ll like the attached package that includes all these changes 🙂


  • Author
  • Freshman I
  • 2 replies
  • April 14, 2025

@harutyungevorgyan Thank you for your solution. This worked perfectly!

To confirm, the KitUnitCost is a custom field, and is working as expected, so no worries there.

If I may ask, how did you discover that the fields were not visible or being hidden through business logic?

 

Thanks again!


harutyungevorgyan
Jr Varsity I
Forum|alt.badge.img+1
jroush82 wrote:

@harutyungevorgyan Thank you for your solution. This worked perfectly!

To confirm, the KitUnitCost is a custom field, and is working as expected, so no worries there.

If I may ask, how did you discover that the fields were not visible or being hidden through business logic?

 

Thanks again!

I reviewed your code for a mobile UI and saw that it is correct. In the next step I've recognized that fields could be hidden and to make sure it is the case I opened SOLine DAC and found these fields, so then I saw that Visible=false for the AvgCost, and to not spent much time on CuryUnitCost field , I've just written the SetVisible in RowSelected because on mobile we need to see the field every time without any conditions.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings