7 Replies Latest reply on May 5, 2014 11:17 AM by philmodjunk

    popover email script



      popover email script


           Back again with another question.

           A solution I am working on for an early childhood education centre has over 100 popover windows which when opened allow the teacher to add a photo or video to provide evidence for specific criteria. It looks and works great and just how they want it.

           I know how to write a script to save the video and attach it as an email and then send it to the parent of that child. The script is then attached to a email icon within the popover. That all works very nicely.

           But since there are more than 100 unique container fields i would need to copy/paste/edit 100+ copies of the script and attach them which is mind-numblingly dull and time-consuming.

           Is there a way to

           a) select (or identify) the container field within the open popover and

           b) write one script that then enters the name of the container field in the currently open popover so that I only have to write the script once?

           I can't see a way of doing it but I don't know everything (or even half of everything!)

        • 1. Re: popover email script

               Take a look at script parameters as a way to pass different file references to the same script.

               Consider getting rid of your "100 unique container fields" and replace them with one container field in a related table of up to 100 related records.

          • 2. Re: popover email script

                 I don't think that would work as I hope the attached screenshot shows?

            • 3. Re: popover email script

                   I don't see why that would be a problem for using either method that I've suggested.

              • 4. Re: popover email script

                     Ok, but forgive my limited understanding, the first time you open the popover it needs to be empty, the user takes a video then the next time they open the popover they need to see the correct video.

                     For the next criteria down the page when they touch the popover it again has to open with no content. 

                • 5. Re: popover email script


                       But that does not mean that you have to use a different container field defined in the same table to do this. Each popover can show the container field from a different related record from the same table of related records. If no such matching related record exists, you'll still get an empty field shown like you do now.

                       But now a single script to save and email the video file can be set up to work from a different record from this table of related videos in order to email the correct video.

                       There are a number of different ways you might use to set this up, but the following example exploits the fact that you cannot have more than one popover open at a time and opening one can trip a script trigger to perform a script to help manage the different related records:

                       Define this relationship: (but use your table and field names in place of mine)

                       LayoutTable::__pkLayoutTableID = Videos::_fkLayoutTableID AND
                       LayoutTable::Selection = Videos::Selection

                       For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

                       Enable "allow creation of records via this relationship" for Videos in the above relationship.

                       Now go to your layout; enter layout mode and open the first popover.

                       Put the container field from Videos inside your popover frame.

                       Select the popover frame and set up the OnObjectEnter script trigger to perform this script:

                       Set Field [ LayoutTable::Selection ; Get ( ScriptParameter ) ]

                       Repeat these steps for each popover, but change the script parameter to a different value for each Popover. You can set up the selection fields as text and pass text as the script parameter or you can make them number fields and pass numbers, 1,2,3 as script parameter values. The key detail is that each popover has to pass a different value to the script as a script parameter.

                       Your button within each popover then can use exactly the same script to export a copy of the video and email it as Videos::containerField will refer to the correct video in each case when performed from a button in the open popover frame.

                       Enter a unique value into the Optional Script Parameter box for this script trigger. This value will be passed as a script parameter to the above script and used to assign a value to LayoutTable::Selection, thereby cont

                  • 6. Re: popover email script

                         Hi Phil,

                         I fell at the first hurdle!

                         In the relationship

                    LayoutTable::__pkLayoutTableID = Videos::_fkLayoutTableID AND
                    LayoutTable::Selection = Videos::Selection

                         I set Selection as a container field for both, however that means that when I try to add the AND part of the relationship both are greyed out.

                         I must have the wrong need of the stick with that. If they are not container fields what are the 'Selection' fields?


                    • 7. Re: popover email script

                           Selection is not a container field. It should be a text or number field. It's not the field into which you insert your video. That's a different field.