Please advise how to make Customize or Workflow Action for Auto Canceling QT when Opportunity Status change to Lost.
Thanks,
Idrus
Please advise how to make Customize or Workflow Action for Auto Canceling QT when Opportunity Status change to Lost.
Thanks,
Idrus
Reclamation is typically done in the application's fundamental() work. Check in the event that QGuiApplication::isSessionRestored() is valid...
You can synchronise an opportunity status with a sales order by means of the following unbound field in SOOrder:
public class SOOrderOpportunityStatusExt : PXCacheExtension<SOOrder>
{
public abstract class usrCROpportunityStatus : PX.Data.BQL.BqlString.Field<usrCROpportunityStatus> { }
protected string _UsrCROpportunityStatus;
[PXString(1, IsFixed = true)]
[PXUIField(DisplayName = "Opportunity Status", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
[OpportunityWorkflow.States.List]
public virtual string UsrCROpportunityStatus
{
get
{
return _UsrCROpportunityStatus;
}
set
{
_UsrCROpportunityStatus = value;
}
}
}
you can calculate its value on the grid of SO501000 screen (where you should add this field)
public virtual void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
if (Base.Filter.Current.Action != SOCreateShipment.WellKnownActions.SOOrderScreen.CancelOrder)
return;
SOOrder row = (SOOrder)e.Row;
//PXFormulaAttribute.Evaluate<SOOrderOpportunityStatusExt.usrCROpportunityStatus>(sender, orderExt);
if (row == null) return;
CRRelation cRRelation = (CRRelation)PXSelectReadonly<CRRelation, Where<CRRelation.refNoteID, Equal<Required<CRRelation.refNoteID>>,
And<CRRelation.refEntityType, Equal<Required<CRRelation.refEntityType>>,
And<CRRelation.role, Equal<Required<CRRelation.role>>>>>>.Select(Base, row.NoteID, row.GetType().FullName, CRRoleTypeList.Source);
if (cRRelation != null)
{
CROpportunity opportunity =
(CROpportunity)PXSelectReadonly<CROpportunity, Where<CROpportunity.noteID, Equal<Required<CROpportunity.noteID>>>>.Select(Base, cRRelation.TargetNoteID);
if (opportunity != null)
{
SOOrderOpportunityStatusExt orderExt = row.GetExtension<SOOrderOpportunityStatusExt>();
orderExt.UsrCROpportunityStatus = opportunity.Status;
}
}
}
(see the
for additional info of link of sales orders with opportunites)
Then you can select the Cancel Order action the SO501000 screen and filter the grid by the Opportunity status = Lost.
I’m not sure this approach (filter by unbound field) works well with schedules though. You can set it up with this condition but I did not manage to make it process any records
You might want to make this field db stored (bound), but then you need to figure out how to update this field on changing the opportunity status (which is workflow-driven field). I believe it is doable.
Let me know if the ‘unbound field approach’ does not work and you need further assistance
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.