4 Replies Latest reply on Dec 16, 2015 12:54 PM by Mike_Mitchell

    Script for a find in field within a portal.

    Christylouise

      How do I write a script to find a word within a field on a portal record? The script I have works perfectly, but doesn't work if the word occurs in another portal row below.

       

      Can anyone tell me what I am doing wrong with the attached script?

      Thanks in advance.

        • 1. Re: Script for a find in field within a portal.
          Mike_Mitchell

          Impossible to tell, since the Find requests are hidden in the Perform Find script step.  

           

          But I can guess where the problem is. You probably have "relatedTable::relatedField = {your criteria}" in your Find request, right? Here's why that doesn't work: When you reference a related field outside of a portal, it references the first related record (either by the sort applied to the relationship or in creation order). If you perform the Find from inside the portal, it will find any parent records for which a related record - any related record - matches the criteria.

           

          Here's what you should probably do:

           

          Enter Find Mode [ ]

          Go to Field [ relatedTable::relatedField ]

          Set Field [ relatedTable::relatedField ; Value: {your criteria} ]

          Perform Find [ ]

           

          What this does is two things: First, it places the focus in the portal so the Find will work properly. Second, it's self-documenting: Anyone who looks at your script can tell what the Find criteria are without having to open up the Perform Find script step.

           

          HTH

           

          Mike

          • 2. Re: Script for a find in field within a portal.
            Christylouise

            Thanks Mike! All fixed, much appreciated

            • 3. Re: Script for a find in field within a portal.
              DavidJondreau

              "When you reference a related field outside of a portal, it references the first related record (either by the sort applied to the relationship or in creation order). If you perform the Find from inside the portal, it will find any parent records for which a related record - any related record - matches the criteria."


              I'm not sure if I'm reading this correctly, but if so, I don't agree.

               

              If you're doing a find on a field from a related record, it doesn't matter if that field is in a portal or not. Sort order doesn't matter, the parent of any related record that matches the criteria will be found.

              • 4. Re: Script for a find in field within a portal.
                Mike_Mitchell

                Just tried it. I stand corrected.