1 2 Previous Next 16 Replies Latest reply on Mar 2, 2017 7:31 PM by sherab4

    Add gender to email


      I have a button the creates an email, inserts the required text and attaches the required PDF. However at the moment instead of the words him or her  I use the word "they" and "them". The Gender IS selected elsewhere on the layout when the record is created. How do I replace the words "they" or "them" with the correct gender. I am sure there must be a way to do this.

        • 1. Re: Add gender to email

          Is this for the PDF or the text in the body of the email?


          And is the text that makes up this message layout text (PDF), Text in the send mail dialog? Text specified in a calculation field or text in a text field?

          • 2. Re: Add gender to email

            It is the text in the body of the email, which is determined from the send mail dialog. See attached.

            • 3. Re: Add gender to email

              Could I create a field for example Him_Her and have a script to SetField this field either "him" or "her" when the Gender is selected. Then add this field to replace Them and They or what ever is used. Maybe two fileds one for "he" and "she". Am I on the right track or is there an easier way.

              • 4. Re: Add gender to email

                One way you can do this is is to have a "gender" field in the table. Then set variables to populate your email body where appropriate.


                Barely pseudo code (just a quick example of the logic and one way to approach it):


                If [ not isEmpty ( myTable::gender ) ]

                     If [ ( myTable::gender = "M" ) ]

                          Set variable [ $heShe; Value: "he" ]

                          Set variable [ $himHer; Value: "him" ]


                          Set variable [ $heShe; Value: "she" ]

                          Set variable [ $himHer; Value: "her" ]

                     End If


                Show custom dialog: [ "Oops!"; "No gender supplied!" ]

                //Do something to address the empty field, i.e. return to a layout to fix the omission, cancel the process, etc.

                End If


                Then use the variables in your body. NOTE: this does not provide for uppercase letters on first word of a sentence, so keep that in mind.


                Rather than nested IF statements, you could use the Case function and address the conditions of M, F, or empty ("") in the Case.


                Edit: added clarification, and fixed typo

                • 5. Re: Add gender to email

                  Where do place this code. Do I need to create a new script?

                  • 6. Re: Add gender to email

                    It depends on your User Interface/User Experience design. Depending on other factors, you could add it to a button that is clicked when the email is generated. So that it sets the variables prior to preparing the email. (Edit: I reread your original post and see you have a button to send the mail. See third paragraph.)


                    I'm sorry, I'm working in Thailand now and internet is by mobile device, plus I'm fighting nasty strain of influenza A (ugh), so if I'm slow to reply or missed part of your description, please pardon me.


                    Are you sending these emails on a per contact basis? Or is it sending them out to a found set of contacts? If the former, you can just add the script to the button you describe in your original post. You can add it to whatever the button script is (at the beginning of the script) or call it as an external script in the button script. If it's a set of contacts (not just one at a time), you'll need to loop through them and address things differently.


                    If you find it not working, check the syntax of the script steps I provided (I was being a bit loose), and you might add a temporary custom dialog to show you what the variables are populated with. If they're blank, try a global variable instead ( $heShe vs. $$heShe ). It depends on your layouts and other steps to know which is required. In my email use cases the local variable is fine ($heShe).


                    Then edit your email body content to include the variables where needed.


                    (Edited to clarify.)

                    • 7. Re: Add gender to email

                      Hi !


                      Another idea would be to replace all the "they" and "them" in your email by the calculation:

                      If ( table::gender_field = "female" ; "she" ; "he" )


                      To me it would be the simplest to implement without changing anything else



                      1 of 1 people found this helpful
                      • 8. Re: Add gender to email

                        Which is actually in essence what dale_allyn said but without using variables.

                        • 9. Re: Add gender to email

                          I think maybe you should re-think the whole process.  In this environment, male/female, he/she, leaves out some people at best, and start a whole issue at worse.

                          • 10. Re: Add gender to email

                            I'm also of the "don't define people's gender" camp, but I've overcome similar issues with plurals by using a flag term in the message body and wrapping the entire message in a Substitute command, e.g:


                            Substitute ( message ; [ "WIDGETFLAG" ; If ( $count = 1 ; "widget" ; "widgets" ] ; [ "CARFLAG" ; If ($count = 1 ; "car" ; "cars" ) ] )


                            - RG>

                            • 11. Re: Add gender to email

                              Regardless of the political correctness of the message itself, all options discussed so far are "brittle". Any future changes to the basic message requires a developer to go in and redesign a calculation. A more flexible approach is to set up a table with text fields for the email subject and body. You enter your message as simple text with placeholders marking where data from your solution is to be inserted. You then use the substitute function to replace the placeholders with data. By putting the message into a text field, authorized users can update the message without the services of a developer.


                              Example: put the following into the te field:

                              <<gender pronoun>> project will be ....


                              in the send mail dialogue, use substitute:

                              substitute ( selectedMessage::Body ;  $genderPronoun )


                              note that by using brackets, a single substitute function can have a list of multiple values to substitute.

                              • 12. Re: Add gender to email

                                I tried this before and I couldn't get the contacts names, addressee names, PDF name etc to fill in by themselves when adding to the text field used for the emails. I used the same script/code as I did in the original screen shot. Obviously this is not what I should be doing.

                                • 13. Re: Add gender to email

                                  What if there is also a need for "his" or "her" can you do this as well using this method.

                                  • 14. Re: Add gender to email

                                    To repeat:

                                    "note that by using brackets, a single substitute function can have a list of multiple values to substitute."


                                    Thus, a single substitute can insert text from any number of fields in place of any number of placeholders. Where I used a variable, you can also use a field or calculation.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next