Skip to main content

I created a graph from another graph like the one below

SOOrderEntry docgraph = PXGraph.CreateInstance<SOOrderEntry>();

but I couldn't insert the data below for the 2022 R2 version

var relation = docgraph.Relations.Insert();

So how can I insert data to the Relations tab in the sales order screen in the 2022 R2 version? It's working in 21 R1 but it's missing in 2022 R2.

Do you happen to know anything about this?

 

 

Hi @Lalith ,
Could you please try below code snippet to insert data in Relations Tab?

 #region Relation: Opportunity -> Sales order

            var relationExt = docgraph.GetExtension<SOOrderEntry_CRRelationDetailsExt>();

            var opportunity = (CROpportunity)PXSelectReadonly<CROpportunity,
Where<CROpportunity.opportunityID,
Equal<Current<Document.opportunityID>>>>.Select(Base);
             var relation = relationExt.Relations.Insert();

            relation.RefNoteID = salesOrder.NoteID;
            relation.RefEntityType = salesOrder.GetType().FullName;
            relation.Role = CRRoleTypeList.Source;
            relation.TargetType = CRTargetEntityType.CROpportunity;
            relation.TargetNoteID = opportunity.NoteID;
            relation.DocNoteID = opportunity.NoteID;
            relation.EntityID = opportunity.BAccountID;
            relation.ContactID = opportunity.ContactID;

            relationExt.Relations.Update(relation);

#endregion

Hope, it helps!


Regards,

Sagar 


Reply