Skip to main content
Answer

IsPrimary field on contact not working in GI results

  • July 19, 2022
  • 6 replies
  • 227 views

Forum|alt.badge.img

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?

Best answer by hkabiri

@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.

6 replies

hkabiri
Acumatica Moderator
Forum|alt.badge.img+8
  • Acumatica Support Team
  • Answer
  • July 19, 2022

@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.


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • July 19, 2022

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?


hkabiri
Acumatica Moderator
Forum|alt.badge.img+8
  • Acumatica Support Team
  • July 19, 2022

@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.

 


Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • July 19, 2022

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


hkabiri
Acumatica Moderator
Forum|alt.badge.img+8
  • Acumatica Support Team
  • July 20, 2022

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


eleanorp
Freshman II
Forum|alt.badge.img
  • Freshman II
  • June 28, 2023

@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.