Hi,
In the Opportunities screen, a client is wanting to have the CloseAsWon action triggered automatically when the Stage field is set to Won. The code below is how I have tried to set it up, but all it does is trigger a Save and nothing else happens.
Is this kind of functionality possible? If so, how would you recommend setting this up?
Let me know if I can provide any other information.
Kind regards,
Andrew
protected void CROpportunity_StageID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (CROpportunity)e.Row;
if (row == null) return;
// Check if the new value of StageID is "Won"
if (row.StageID == "W")
{
//Trigger the "Close As Won" action
TriggerCloseAsWonAction();
}
}
private void TriggerCloseAsWonAction()
{
var closeAsWonAction = Base.Actionss"CloseAsWon"];
if (closeAsWonAction != null)
{
closeAsWonAction.Press();
}
}