Please assist in create customized email types. Most of the work is done, I just need to make it so when a custom button in the email field is selected, that the text fields from business, personal are updated.
Any advice is appreciated.
I am in the process of upgrading our school (Johnson County Community College, Overland Park, KS) to Sugar 7 and I need to redo this customization that I created in the past, but was not upgrade safe. I have started the process, but I need help.
Steps needed to add customization:
1) Add business_email_c, personal_email_c and school_email_c text fields to Contact Module Form (I hope to make these hidden in the future)
2) Moves files in folder from GITREPO to your instance of Sugar 7
custom/modules/Contacts/clients/base/fields/email
custom/modules/Contacts/clients/base/views/record
I have modified the email field in the Contact Module:
- Added 2 additional buttons for business and personal in edit mode (edit-email-field.hbs)
- Added 3 possible labels school, business and personal in detail mode (detail.hbs)
- Added code to only let one business and one personal button to be selected, like the primary email address button (select_one_email_type.js)
- Buttons(edit view) and labels(detail view) are selected when page is rendered base off of two text field also on the form containing the emails school_email_c, business_email_c and personal_email_c field (Note: school email button is missing from edit view, because it on our system the source of record is an other application)
- Made changes to javascript to allow function that calls the handlebar edit-email-field.hbs to include business_email, personal_email, school_email, and has_email_types
I have copied from original and customized the record view render function to:
- Pull this.model.attributes.business_email_c, this.model.attributes.personal_email_c, this.model.attributes.school_email_c
- For each email array in this.model.attributes.email
- creates and sets email.has_email_types to TRUE
- creates and sets email.school_email based on whether email.email_address === school_email (value of business_email_c text field)
- creates and sets email.business_email based on whether email.email_address === business_email (value of personal_email_c text field)
- creates and sets email.personal_email based on whether email.email_address === personal_email (value of school_email_c text field)
Below is how the customization will appear.
I mentioned this project to the following before.
Please let me know what you think.
Hi Amelia,
Unfortunately I've not tried to do this and will be of little help to you but, though this may be just a typo in your post, if you are extending within the Contacts module you should do so in:
custom/modules/Contacts/clients/base/fields/email/edit-email-field.hbs
When you solve this you should propose your solution as a DeveloperBlog post, it would be interesting to many.
best of luck
FrancescaS