14 Replies Latest reply on Feb 15, 2017 8:48 AM by PSI

    How to choose a portal

    user25183

      I have a window with 2 portals.

       

      Is there a way to select the portal for my script to work on?

       

      It might be obvious but I don't see it!

        • 1. Re: How to choose a portal
          Philip_Jaffe

          How is your script triggered?  What does it do?

           

          Answer is almost certainly, "yes," but can you give a bit more information?

          • 2. Re: How to choose a portal
            Vaughan

            It's better to work on the related records rather than a portal. Walking portal rows is not reliable.

             

            The script would at some point use the Go to Related Records script step to select the related records to work on. The step specifies the relationship to use. Often this is done in a separate window.

            • 3. Re: How to choose a portal
              PSI

              Use Go To Field () and select one of the field in the portal you want to address. Then you can navigate the portal rows.

               

              John

              • 4. Re: How to choose a portal
                user19752

                You can name each portals in inspector, then "Go to object" can specify the name.

                • 5. Re: How to choose a portal
                  user25183

                  The Script is in a menu.

                  not sure what you need

                  It create basic entry in the portal, the user then fill the remaining part.

                  • 6. Re: How to choose a portal
                    user25183

                    thanks

                    I will try

                    • 7. Re: How to choose a portal
                      keywords

                      Just taking that further, the only way, in a script, to choose between portals on a layout is to give each portal a name (as shown) and use Go to Object. This will put the focus on the specific portal, then Go to Portal Row [ last ] will take you to the empty row at the end of the portal, which will be there for data entry purposes if you have check the portal relationship to allow creation of records. you could the use Go to Field to land the cursor in a specific field in that row.

                      This is a pretty standard method of achieving this particular task.

                      • 8. Re: How to choose a portal
                        PSI

                        I have no problem with naming the portal and using go to object but it isn't the only way.

                         

                        Go To field works fine on it's own.

                        • 9. Re: How to choose a portal
                          user19752

                          Go to Field is good shorthand if there is only one instance of the field in the layout.

                          Object name is always unique in a layout.

                          • 10. Re: How to choose a portal
                            PSI

                            Not really as the field in the portal would show as...

                             

                            MyPortalRelationship::thefield

                            • 11. Re: How to choose a portal
                              philmodjunk

                              "Not really as the field in the portal would show as...

                               

                              MyPortalRelationship::thefield"

                               

                              And you've never put two or more portals based on the same relationship on the same layout, perhaps with different portal filters or to set up a "horizontal portal"?

                               

                              Go To Object is by far the better option.

                              • 12. Re: How to choose a portal
                                PSI

                                Good Point.

                                 

                                I agree, in the case of  2 of the same portals with portal filters Go To Object is the best option.

                                 

                                I guess I rarely use portal filters. I usually do the filtering via the relationship so the path to the field is different.

                                • 13. Re: How to choose a portal
                                  philmodjunk

                                  Yes, but you missed part of what I'm trying to say.

                                   

                                  Go to field may work perfectly fine now, but will it always work in the future?

                                   

                                  Neither you nor I know what changes might need to be made to a layout in the future. And if you change the layout by adding another instance of the same field object--which does not even need to be in a portal as fields from related tables can be added directly to a layout, you may keep your script that uses go to field from putting the focus where it's needed. If you use go to object, you are less vulnerable to such issues.

                                   

                                  Please note that scripts that process data in a related table by looping through portal rows are vulnerable to such problems even when Go to Object is used, it just reduces the number of possible failure points. The original question here may be a case of simply using go to portal row to put the focus on a row and leave it here, but if you are looping through the portal rows to add or modify records in a related table, there are other options that are not nearly so "brittle" and I thus avoid such scripting in my own work.

                                  • 14. Re: How to choose a portal
                                    PSI

                                    I do get it and mostly agree it is better to use Go To Object. I am well aware of how I integrate these features in my solutions. For the casual developer it is probably better to use GTO.

                                     

                                    I am also not a fan of 'walking the portal' to edit related records but there are times when it makes sense.