Solved

How to remove dependency of probability in Opportunities screen ?

  • 27 May 2022
  • 6 replies
  • 120 views

Userlevel 2
Badge

In this form the text field of Probability(green) is dependent on the StageId(blue) is there a way I can remove this dependency and use my new custom field of Probability(yellow) to update the probability text field(green)??

 

 

icon

Best answer by Leonardo Justiniano 3 June 2022, 02:19

View original

6 replies

Userlevel 2
Badge

Can anyone please provide any solution here ???

Userlevel 6
Badge +5

Hi @param2022 

Please override the following view in OpportunityMaint graph

public PXSelect<CROpportunityProbability,
Where<CROpportunityProbability.stageCode,
Equal<Current<CROpportunity.stageID>>>>
ProbabilityCurrent;

As you can see Probability field belongs to CROpportunityProbability

 

Userlevel 2
Badge

@Leonardo Justiniano thanks for suggesting this way can you tell me how can we override a view ? Or a reference to official documentation please ??

Userlevel 6
Badge +5

Hi @param2022 

 

You just need to define your new view with the same name in the graph extension like:

 

// Assuming you have a CROpportunityExt.UsrMyProbability
//
public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint>
{
...

public PXSelect<CROpportunityProbability,
Where<CROpportunityProbability.stageCode,
Equal<Current<CROpportunityExt.UsrMyProbability>>>>
ProbabilityCurrent;

...
}

 

 

Userlevel 2
Badge

@Leonardo Justiniano I have tried what you suggested but it is still not working. The CROpportunityProbability probability(green one) is still updating with on change of stage field. I have tried overriding fieldUpdated for stage event also but that is also not working.

Userlevel 6
Badge +5

Hi @param2022 

You need also to refresh the view when changing the value. To accomplish that set CommitChanges to True on the field “UsrMyProbability”

 

This is the snippet:

namespace PX.Objects.CR
{

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class CROpportunityExt : PXCacheExtension<CROpportunity>
{
#region UsrMyProbability
[PXDBString(15)]
[PXUIField(DisplayName = "My Probability")]
[PXStringList(new string[] { "A","L","N","P","Q","R","V","W"}, new string[] { "60", "0", "5", "10", "20", "80", "40", "100" })]
public string UsrMyProbability { get; set; }
public abstract class usrMyProbability : PX.Data.BQL.BqlString.Field<usrMyProbability> { }
#endregion
}

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint>
{

public PXSelect<CROpportunityProbability,
Where<CROpportunityProbability.stageCode,
Equal<Current<CROpportunityExt.usrMyProbability>>>>
ProbabilityCurrent;

protected void _(Events.FieldUpdated<CROpportunityExt.usrMyProbability> e)
{
ProbabilityCurrent.View.RequestRefresh();
}

}
}

A FieldUpdated event must be created to refresh the view.

 

To remove the link with Stage field is more complicated. There are a lot of logic behind it ( Look at CROpportunityStages attribute implementation). I suggest a different approach trying to adapt Stage field instead.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved