Hello,
I am currently trying to add a button to Cases where I can create an opportunity. See below for graph initiation and insert. Note that this is proof of concept.
#region Actions
public PXAction<PX.Objects.CR.CRCase> CreateOpportunity;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Create Opportunity")]
protected void createOpportunity()
{
CRCase cCase = Base.Case.Current;
OpportunityMaint graph = PXGraph.CreateInstance<OpportunityMaint>();
CROpportunity opty = new CROpportunity
{
BAccountID = cCase.CustomerID,
ContactID = cCase.ContactID,
//Status = "N",
//ClassID = "SERVICE",
//StageID = "L",
Subject = cCase.Subject
};
graph.Opportunity.Insert(opty);
if (graph != null)
{
PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
}
}
#endregion
However, I’m getting an odd error when I try to execute. See below for snip.
Any help regarding this error would be greatly appreciated.