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

isInList(related($contactlist_c,"primary_contact_c"),createList("Yes"))now(),date("null"))

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

can someone help me get the right formula for this. 

Parents Reply
  • 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. 

Children
  • 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. 

  • 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 sg-chu-experimento.demo.sugarcrm.eu/ (login admin, password asdf) and play with it

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


    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient