Skip to main content
Answer

Error in value of GetExtension code

  • December 22, 2020
  • 2 replies
  • 648 views

Hello,

 When I set the value of GetExtension, the variable gets null.         

 foreach (SOLine soline in listOfLine1)
            {
                SOLine line = new SOLine();

                //…. code

                var lineExt = SOGraph.Transactions.Current.GetExtension<Objects.SO.SOLineExt>();

                lineExt.UsrMargeLine = GetPercentMargin(line);

                SOGraph.Transactions.Insert(line);
                SOGraph.Actions.PressSave();

            }


Best regards.

Best answer by Naveen Boga

Hi @mohamed1walha 

Can you please add this line of code and verify

SOLineExt lineExt = Base.Transactions.Cache.GetExtension<PX.Objects.SO.SOLineExt>(line);

Hope this helps!!

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • December 22, 2020

Hi @mohamed1walha 

Can you please add this line of code and verify

SOLineExt lineExt = Base.Transactions.Cache.GetExtension<PX.Objects.SO.SOLineExt>(line);

Hope this helps!!


  • Author
  • Jr Varsity II
  • December 22, 2020

thanks @Naveen B  for your answer, i will test with it.