7 Replies Latest reply on Jul 1, 2016 8:41 AM by karina

    Assign portal row values from lookup popover

    hampdentech

      I am attempting to fill in the last (newest) row in a portal with values selected from a popover. I can show the popover and select the item from the list but it always assigns the values to the first row in the portal. I can't figure out what I am missing.

       

      I have tried several different methods and it always assigns to the first row. Following is the latest script that I have tried..

       

       

      Insert Inventory Part to Work Order Part.png

      What am I doing wrong here?

       

      Thanks!

        • 1. Re: Assign portal row values from lookup popover
          siplus

          Do you have only one portal on that layout ?

           

          why don't you just substitute the lines 5 to 12 with go to portal row [last] ??

          • 2. Re: Assign portal row values from lookup popover
            hampdentech

            The popover is not actually launched from a portal because the popover window contains a portal for the items to locate. As they say around here "light shines on Marblehead." I think I'm not even referencing the portal that contains the work order parts. I must still be referencing the inventory lookup portal.

             

            Is there a way within the script to reference a row on the specific work order parts portal (ptl_WorkOrderParts)?

            • 3. Re: Assign portal row values from lookup popover
              siplus

              Give your destination portal a name, then go to object [given name], then go to portal row [last].

               

              However, I try to avoid entering data in a portal. I prefer to capture the destination related record's ID, set a global to it and use a relationship based upon that global to set field values.

              • 4. Re: Assign portal row values from lookup popover
                karina

                Hi,

                 

                You can also pass the partsID as a optional script parameter to a script and set the variable $PartsID with Get ( ScriptParameter ).

                It's also possible to pass multiple values to a script. (let me know if you want to know how)

                Screen Shot 2016-06-30 at 22.41.09.png

                • 5. Re: Assign portal row values from lookup popover
                  weaverd

                  As I understand it you are trying to add a new part to a work order. You select the part from a portal in a popover (not the portal where your assigned parts reside), use your script to assign variables with relevant part details, and these are to be used in the last (empty) portal row where the work order part record is created and field values are set.

                   

                  Instead of looping through the workorder_PARTS portal to find the empty portal row (I assume you have allow creation of new records turned on in the relationships graph for this TO), why not simply navigate to the layout for work order_PARTS, create a new record, use your set field steps on the work order_PARTS layout, and return to your original layout, and if necessary use Go To Object to get back to where you started. This way you can turn off allow creation of new records via this relationship in the relationships graph to get rid of the empty row.

                   

                  I think the problem with using Set Field in the portal is that the new related work order_PARTS record has not been created yet, and so Set Field simply finds the first related record (first portal row), and sets the values there. More than happy to create an example file for you if you wish.

                  • 6. Re: Assign portal row values from lookup popover
                    hampdentech

                    Okay, using "Go To Object" with the portal name did the trick. Works perfectly now.

                     

                    Here's the updated script...

                     

                    Insert Inventory Part to Work Order Part.png

                    • 7. Re: Assign portal row values from lookup popover
                      karina

                      Hi,

                      Can you mark siplus answer as correct.

                      Then the other FMers can see this question is answered