Field that auto prints date when another field is updated

Trying to created a Primary Contact field on our Accounts / Contacts modules.

The field has a simple Yes/No Drop down... 

I would like another field next to it (Primary Contact updated) that automatically puts the date in if someone chooses Yes for the primary Contact field. 

this is what i have so far but its just not right


so if primary_contact_c = Yes, then input date, ifelse then null

can someone help me get the right formula for this. 

  • Hello Frank,

    What business task are you trying to solve?
    Why not just to add a Relate field Primary Contact to your Accounts and set checkbox Audit for it?
    You will have info regarding the user and time the value is changed in the Audit Log

    Like this:

    Best Regards,
    Dmytro Chupylka
    We make work in Sugar CRM system faster, more convenient and efficient

  • We at times have 20+ contacts for a company, the marketing team is looking for a field that could be updated to know which of those contacts is the current primary contact.

    that has been created.. its yes or no. Like Yes this is the primary contact for this company, or no its not.

    the second part is, if that field gets updated to yes, id like a field that displays when it was last changed to yes. 

    so with a quick glance we can tell if its current information or if it hasnt been updated in years. 

  • What happens when you have twenty contacts and which one already has that flag set and you set the flag on another contact. You get two prmiary contacts? 

    I would suggest to have a relate field on the account and have a bit of logic (logic hook for intance) that checks if that field is filled. If so it sets a calculated value on the contact so users can see in the subpanel that it's the primary contact. This way you only can have one primary contact. I dont know for sure if this is possible with studio work alone. 

  • Assuming your contacts are related to just ONE Account, not multiple Accounts.

    I would add an audited field on Contacts called "Primary Contact".

    Also add that flag to your list view and search results so that users can see/search-for the "Primary Contact" when deciding which contact to use on things like Opportunities etc. 

    Option 1.

    Add a check in the Contact module record and create view controllers to see if the "Primary Contact" box is checked, if so see if the Account related to that Contact has another Primary Contact. If the Account already has a Primary show a Confirmation Alert so the user knows they will be unsetting that Primary to make this the Primary.

    Then add a Logic Hook that, when the record is saved, checks if the Primary Contact changed from unchecked to checked, in which case find any Primary Contact on the Account and unset that one. (I am assuming you don't want multiple Primary Contacts on an Account as that would defeat the purpose). Make sure your logic hook excludes the Contact you just selected as your primary when looking at related Contacts.

    Option 2.

    You could make that checkbox editable ONLY in the subpanel view of the Account (by forcing it to read-only on all the other views: create, record, list, and leave it out of any other Contacts subpanel views that are not on Accounts).

    This forces the user to see all the Contacts on the Account and pick the Primary.

    In your subpanel view controller you would take care to uncheck any other Contact that was primary.

    The downside of this latter approach is that when someone creates a new Contact and relates it to an Account they can't mark the Contact as primary during the creation, they have to go to the Account after the Contact is created and mark it Primary from there. It also means that any API that creates a Contact with the Primary checked will NOT unset the flag.

    Overall, I would say Option 1 is probably your safest bet.

    As Dmytro said, the audit on the "Primary Contact" will take care of stamping changes, and in this example will mark both non-primary to primary on your current Contact and primary to non-primary on the Contact that used to be Primary.

    If you want, you can also add a couple of read-only fields for Primary Contact last changed, and Primary Contact changed by. Those could easily be populated by the logic hook (in Option 1) or controller (in Option 2). But you need to be sure to update both them in both the new and old primary Contact record.


  • Oh, I see...
    Then, is that look like you need it to work?   

    I did it in a few minutes by configuring a logic hook, you may read it easily by following the white line:

    Also as Jeroen said, it totally makes sense to adjust the logic hook a little bit, so that if Contact is set to IsPrimary=Yes  other contacts of that Account are set to IsPrimary=No automatically 

    Also, the "Became Primary At" field could be arranged not per Contact but for Account record (or both of them)...

    You are welcome to log in (login admin, password asdf) and play with it

    Then let me know via the Club Message or emailto - I will help you to make it work for your Sugar

    Best Regards,
    Dmytro Chupylka
    We make work in Sugar CRM system faster, more convenient and efficient