Solved

IsPrimary field on contact not working in GI results

  • 20 July 2022
  • 6 replies
  • 146 views

Userlevel 5
Badge +1

I'm trying to create a simple GI to display vendor contact information. I've connected the PX.Objects.AP.VendorR table to the PX.Objects.CR.Contact table and related them by bAccountID field.

I'm able to get the results I'm looking for, however I've added the "IsPrimary" field to the results so users can see which contact is the primary one for that vendor account and it does not appear to be working correctly. In the GI results that field is displaying a False result (unchecked box) for all contacts, even those designated as the Primary contact in the Vendor.

Any thoughts as to how to fix this?

icon

Best answer by hkabiri 20 July 2022, 01:16

View original

6 replies

Userlevel 6
Badge +5

@mikeho That is right, cause the IsPrimary is a calculated field which is being set at the runtime and there is no such field on Database.

The formula behind this field is Vendor.PrimaryContactID=ContactID

So you need to do left join for Vendor and Contact table with relation of BAccountId for both DACs and right a formula IIF (Vendor.PrimaryContactID=Contact.ContactID, ‘True’, ‘FALSE’)

 

Hope I could clarify the logic behind this field and how to display the correct value on your inquiry.

Userlevel 5
Badge +1

Thank you, @hkabiri! Yes, that makes sense and I was able to create the field I required using your formula.

For future reference, is there a simple way for me to be able to tell the difference between a calculated field and a field that is actually available in the Database?

Userlevel 6
Badge +5

@mikeho 

You can go to DAC Schema Browser from the field Data Class (ctrl+alt+click on field) and you can see the field has Nonexistent in DB tag next to it.

 

Userlevel 5
Badge +1

Interesting! Looks like that is a feature available in 2021 R2 and later builds. Something to look forward to, I suppose.

Userlevel 6
Badge +5

@mikeho That is correct this is a new feature introduced in 2021R2 and later.

Userlevel 2
Badge

@hkabiri Do you have any advice for finding the formula to add similar fields to a GI? I am trying to use POVendorInventory.IsDefault and can’t find an equivalent way to calculate it. 

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