3 Replies Latest reply on Jun 15, 2012 6:22 AM by philmodjunk

    Email contacts from portal using radio button Boolean values to select records

    EllaMonson

      Title

      Email contacts from portal using radio button Boolean values to select records

      Post

      Using: FileMaker Pro 12 Advanced

      Hi there

      I am a Filemaker beginner/novice (no experience in scripting or calculations though I am willing to learn), and I have a database with related tables as below. The tables are related through a junction table Contacts_Projects; Contacts_Programs etc

      Relationships:

      • Contacts:Projects
      • Contacts:Programs
      • Contacts:Submissions
      • Contacts:Jobs

      There are portals in the tables Projects, Programs, Submissions and Jobs which show the Contacts related to each record therein.

      Each portal has a radio button field with Boolean values (yes/no). This field is stored in the relevant junction table.

      I want to be able to:

      1. Have this Boolean field available in each row of the portal
      2. Connect a ‘Send Email’ button to all contacts that have a ‘yes’ value selected in their row of the portal.

      The email addresses are stored in the table “Contacts”. Each contact can potentially have two associated emails stored in the fields “Personal Email” and “Business Email”, and I’d like the email generated to be sent to both emails via my email client.

      Any assistance in how to do this would be greatly appreciated.

      Thanks,

      Ella

        • 1. Re: Email contacts from portal using radio button Boolean values to select records
          philmodjunk

          1) base your portal on the junction table and include fields from the other, related table (contacts?) on the far side of the junction table to supply name on other such info. Then you can include the radio button field as well.

          2) Put a button in the portal row that performs a script that includes the send mail script step. The mouse click on the button will also put the focus on that portal row so references in your send mail step to fields in the portal will reference the correct record. If necessary, your script can use Go To Related Records to pull up this record (or the contact record ) on another layout, but that doesn't seem necessary from what you have posted so far.

          • 2. Re: Email contacts from portal using radio button Boolean values to select records
            EllaMonson

             Hi PhilModJunk

            Thanks for your reply.

            I think I may not have been quite specific enough, but nevermind, - a lovely fellow wrote a script as follows, which can be ammended for a button on each relevant table.
            Apologies if I havn't re-written the script here acording to convention...

            Go to Layout ["Contacts_Projects"(Contacts_Projects)]
            Perform Find [Criteria: Contacts_Projects::Email Job Contacts:"YES"]
            Send Mail [Send via E-mail Client; BCC:Contacts::Personal Email & ";" & Contacts::Organisation Email]
            Go to Layout [original layout]

            AMAZING! This changed my world.

            It did, however, leave me with another question.

            At the moment the script is searching for all the ‘yes’ values in all the records of the layout as a whole, which means that an email is being generated and sent to all the Contacts in the whole layout with  ‘yes’ selected in the corrosponding field.
             
            What I need to do is generate an email only to the selected Contacts in the portal of the specific record that I chose to press the ‘send email’ button in. 
             
            I think I have two choices, neither of which I’ve been able to make any progress at all on in the last couple days:

            1. Write a new script to reset the Boolean values in the portal back to ‘no’ when the record is exited
            2. Alter the current ‘Send Mail’ script a bit to be more specific so as it’s only sending the email to the selected Contacts in the specific record that I chose to press the ‘send email’ button in.


            It all seems so simple, but try as I might, I can’t seem to get any closer. It’s been days and I still suck at scripting.


            If you or anyone has any advice that would be great.

            Thanks,
            ella

            • 3. Re: Email contacts from portal using radio button Boolean values to select records
              philmodjunk

              Instead of go to layout, use:

              Go To Related Record [Show only related records; From table: Contacts_Projects; Using layout: "Contacts_Projects" (Contacts_Projects)]

              This produces a found set of just the records in your portal for the current record from which you performed this script.

              Then use:

              Enter Find mode [] //clear the pause check box
              Set Field [Contacts_Projects::Email Job Contacts ; "yes" ]
              Set Error capture [on]
              Constrain found set[]

              This reduces your found set to just those with the radio button selected.