Solved

How to access relations view in the sales order graph from another graph - 2022 R2

  • 9 November 2023
  • 1 reply
  • 34 views

Userlevel 1
Badge

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?

 

 

icon

Best answer by Sagar Greytrix 27 November 2023, 13:30

View original

1 reply

Userlevel 5
Badge +1

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


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