Solved

Is there a way to have the phone no and email automatically populate in additional account info when typed into the primary contact?


Userlevel 5
Badge +1

With most of our customers we want the email address and phone no to be the same in primary contact and additional info.  To save someone having to do this twice is there a way to have the email address and phone no automatically entered into the additional account info when it has been entered into primary contact or vice versa? This would only be if those fields were blank when entering into the other field so should not end up overwriting anything someone typed.

 

Thanks for any help, even if it’s to say this is not possible.

 

Phil

icon

Best answer by rosenjon 14 June 2022, 05:55

View original

7 replies

Userlevel 7
Badge +17

Hi @ppowell  To achieve this, it requires a small piece of customization.

Userlevel 5
Badge +1

Thanks for confirming it’s possible.

 

I believe I would need the add a field updated event and put in the logic there to update the field with the value that was just updated.

I had a look at adding this on the primary contact field (top right) and can get the value I want to insert into the default contact email address field (bottom left under additional account info) but I can’t see how to reference that field.  They both seem to be called Contact.EMail and if I add an event handler to either I seem to end up with the same code. Is there a way to specify it's the contact,.email under DefContact instead of PrimaryContactCurrent?

 

This is what I have so far which admittedly is not much:

protected void Contact_EMail_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
    {
      if(InvokeBaseHandler != null)
        InvokeBaseHandler(cache, e);
      var row = (Contact)e.Row;

      if (row == null) return;

      // Update the value in Contact section
      PXTrace.WriteError(row.EMail);
      
      
    }

 

Or am I going about this completely the wrong way?

 

Thanks for any pointers,

 

Phil

Userlevel 7
Badge

Hi @ppowell were you ever able to resolve your issue? Thank you!

Userlevel 5
Badge +1

Hi @Chris Hackett, no we were not able to resolve this and it would really save a lot of time for us if this was possible. I’ve looked at it again and I just can’t tell how to target the correct fields to accomplish this.

 

Phil 

Userlevel 5
Badge +1

Hi @Naveen Boga, thanks for responding, I really appreciate it.  I’ve had a look but I’m stumped on how to target the correct Contact fields.  Do you know how I would target the correct field to update the additional account info email and phone no when the primary contact email and phone no is entered?

 

Thanks,

 

Phil

Userlevel 6
Badge +5

You might want to check the answer on this one: acumatica - Updating default contact on customer adds new record - Stack Overflow

You will want to target the BAccount record as the base graph, and then update your Contacts relative that record. The Additional Account Info is part of the DefContact record. There are some “default” contacts for Customer records that live behind the scenes and implement an inheritance scheme. MainContact is the primary contact object, and it contains the address info in the “General” tab of the Contact screen. Then there are the Billing and Shipping contacts, which will inherit from Main Contact, unless the “Override” option is chosen on the Billing or Shipping screens. The info you want to update is located in the “DefContact” record, which is another behind the scenes contact record for the “Additional Information” section of the Customer record.

So I think targeting FieldUpdated is fine. But these records reside in different contact objects, and unless Additional Info has been filled out yet, the DefContact might not even exist yet. So you will have to manage populating DefContact and the Primary contact when the other is created or updated.

Userlevel 5
Badge +1

Hi @rosenjon, thanks so much for your response.  I will look into doing it that way.  I really appreciate you giving your time to answer this.

 

Phil 

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