Skip to main content
Solved

Populating Custom Fields in Create Purchase Orders (PO505000)

  • September 24, 2024
  • 7 replies
  • 101 views

Forum|alt.badge.img

Hi,

I have a small customisation to populate a few custom fields on PO505000 that works but I have a question on whether this is the most efficient way to achieve the outcome (from a database perspective).

The custom fields are highlighted below:

 

 

Trans Desc is the TransDesc field from SOLine

Description and Reference are the OrderDesc and CustomerRefNbr fields from SOOrder

 

The code in place to achieve this is shown below:

 

My question is this:

After the Unwrap statements on lines 41 and 42, the soOrder and SoLine objects are populated with sum data but no others.  How is this controlled?

At line 43 the 3 fields I’m wanting to source are null.  So, as a work around I am explicitly querying the database to retrieve all the SOLine and SOOrder.  This results in a lot of additional queries, and this is what I’m looking to avoid.

The DAC extension I’m using is:

 

 

Thanks in advance for any advice,

John

 

 

Best answer by andriitkachenko

If you take a look at the GetFixedDemandFieldScope method in the POCreate, it defines the list of fields that should be polled from the database. If you override this method, and the fields that you need - you won’t need to make your separate queries.

Moreover, if you change the screen to show those 3 additional fields from the SOOrder and SOLine respectively - you can ditch your DAC Extensions altogether.

View original
Did this topic help you find an answer to your question?

7 replies

hdussa
Jr Varsity I
Forum|alt.badge.img
  • Jr Varsity I
  • 99 replies
  • September 25, 2024

Hello @JWS539 ,

 

After the Unwrap statements on lines 41 and 42, the soOrder and SoLine objects are populated with sum data but no others.  How is this controlled?

 

I am trying to understand “populated with sum data”. Unwrap simply extracts the given DAC record from the PXResult object so in this case it should return the SOOrder and SOLine records.

Please share more information if it is not returning a single record.

 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 71 replies
  • September 25, 2024

Hi Harish,

 

Thanks for reviewing this topic. 

My English wasn’t as good as it could have been.  What I intended to say  was “the SOOrder and SoLine objects are populated with data for some of the fields but not others”. 

The below is a screen shot of the contents of soOrder after the code runs on Line 41 ie.

var soOrder = PXResult.Unwrap<SOOrder>(rec)

You can see that some of the properties of the object are populated and some are not.  For example CustomerRefNbr is null.  This is one of the fields I’m looking to retrieve.

 

 

So, it looks like there is something some where that influences what Unwrap returns and what it doesn’t

My thinking is that I probably need to override the projection further somehow as this is probably what determines which fields get populated and which do not.  If so I’m not sure how?

Hopefully the above is a better explanation of the issue.

 

Thanks,

John.

 


hdussa
Jr Varsity I
Forum|alt.badge.img
  • Jr Varsity I
  • 99 replies
  • September 25, 2024

Hi @JWS539 ,

 

Thanks for more details!

I checked the BQL Select. Since the SOOrder is not the primary DAC in the BQL, all field values will not be displayed. Creating a Projection DAC including all the fields needed is an ideal approach for you.


Creation of Project DAC Link: https://asiablog.acumatica.com/2018/03/pxprojection-sql-views-using-bql.html 

 

Hope this helps!


andriitkachenko
Jr Varsity I
Forum|alt.badge.img+6
  • Jr Varsity I
  • 106 replies
  • Answer
  • September 25, 2024

If you take a look at the GetFixedDemandFieldScope method in the POCreate, it defines the list of fields that should be polled from the database. If you override this method, and the fields that you need - you won’t need to make your separate queries.

Moreover, if you change the screen to show those 3 additional fields from the SOOrder and SOLine respectively - you can ditch your DAC Extensions altogether.


Forum|alt.badge.img
  • Author
  • Varsity I
  • 71 replies
  • September 25, 2024

Hi,

Thanks Andrii and Harish for your help,

The last solution above worked really well.  On thing I discovered though was that it seems you can’t call the base method from within the delegate (no major).  My first attempt was:

which resulted in only the three columns

But the revision below worked:

 

So, problem solved.  Thanks for the help.

John

 

 


andriitkachenko
Jr Varsity I
Forum|alt.badge.img+6

@JWS539 You can call the baseMethod() from the delegate, you just didn’t return values that you got from it.

I’ve created a small example here - https://dotnetfiddle.net/Q1Kpoc

It’s simplified and does not use Acumatica, but it operates in the same way.

Just copy-pasting the entire field set from the original method will work for you, but it’s a less future-proof solution - in case the field set is changed in the future, you might need to spend some time searching for this change and then updating your customization.


Forum|alt.badge.img
  • Author
  • Varsity I
  • 71 replies
  • September 26, 2024

Hi Andrii,

Thanks for the example


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings