Skip to main content

Hi everyone,

i’m facing a problem when i populate the Sales quotes lines from an imported file, everything is working fine when the lines were populated, but when i choose a customer from the header field, the fields returns zero for all the rows : 

Unit Price with the values

and after choosing a customer:

 

field returns 0

i tried to use RowUpdated to get the old values back if the new value is 0 : 
 

public static bool IsActive() => true;
protected virtual void _(Events.RowUpdated<CROpportunityProducts> e)
{
var nR = e.Row;
var oR = e.OldRow;

var nUnitPrice = nR.CuryUnitPrice;
var oUnitPrice = oR.CuryUnitPrice;


if (nUnitPrice == 0)
{
nR.CuryUnitPrice = oUnitPrice;
}
}

the code works fine, but the Ext Price is still showing 0, and automatically the Amount field also:
 


Any thoughts?

Any one can help here?


Is there a reason that you aren’t populating the Customer/Business Account first?  The system wants to recalculate prices when the customer changes


@meganfriesen37 yes, i know that it’s a recalculation issue, but for example if i populate it with the wrong customer then i correct it, it will be nulled, i wanted to know if i can fix this behaviour

 


Hi @hmzamr were you able to find a solution? Thank you!


Hi @hmzamr,

How do you do your pricing?

 

Is the Test account allocated a price band if you use price banding?

 

As a workaround, could you upload the file again after changing the customer?

 

If you use the ‘Update All Existing’ when importing the file, this will leave all that is the same and change all different values.


I’m also pretty sure there should be a recalculate prices button within Sales Quotes, that might be worth checking out.


but if all that fails,

 

protected virtual void _(Events.FieldUpdated<CROpportunityProducts, CROpportunityProducts.inventoryID> e)
{
CROpportunityProducts row = e.Row;

if(row.InventoryID == null) return;

if(row.InventoryID != null)
{
e.ReturnValue = row.CuryUnitPrice * row.Quantity;
}
}

Let me know if this works, however I think it would be best to not modify this with more logic, but rather get down to the core issue.

 

We use price banding and if a customer has no price band allocated, we also see this effect.

 

After allocation, the prices should change by customer if the price band is different.

 

I think the reason your RowUpdated Handler also doesnt trigger  is because you dont use the SetValueExt method which won’t call the FieldUpdated event handler to cause the PXFormula within CuryExtPrice to trigger.


Reply