3 Replies Latest reply on Apr 17, 2012 2:49 PM by followtheharvest

    Script to add info to a portal



      Script to add info to a portal


      I want to create a script that when I push a radio button it adds 16 lines to a portal and then adds specific information into 2 fields in that portal for each line. 1. ProductID 2. A specific week that corresponds with the Product ID. (The whole portal is based off my OrderLine table)

      Basically I have an if statement started, after my initial if statement I have:

      Go to portal row (select:first)

      Insert text (OrderLine:ProductID[OrderLine:ProductID="1"])


      That doesn't even seem to work so I don't know what to do!




        • 1. Re: Script to add info to a portal

          I would guess something like:

          - Set Variable [$ProductId;  ProductsTable::ProductID]
          - Go To Layout [OrderLine]
          - New record Request
          - Set Field [OrderLine::ProductIdFk; $PrioductId]
          - Place more set field steps here to set the fields you want to set.
          - Create as many new records as you need by adding "New Record/Request" steps
          - Go To Layout [Product]

          If you don't want to leave your window you can also let this whole sequence ron in a new window. That way you need to end tyour script by closing the window.

          Let me know if this helps.

          • 2. Re: Script to add info to a portal

            DaSaint's script can be looped to create your 16 new records. We do something similar to "pre load" our invoices with the 4 most common items to speed up service to our customers.

            Insert text (OrderLine:ProductID[OrderLine:ProductID="1"])

            Failed because [OrderLine:ProductID="1"] has two problems:

            1) the [] brackets refer to a repetition of the ProductID field, the data you want to insert into the field would need to be added in a different dialog box that pops up when you click the lower "calculated result" check box.

            2) OrderLine:ProductID="1" is a logical or "boolean" expression that evaluates as True or False. True is the same as 1 and False is the same as 0 so this expression evaluates as either 1 or 0 depending on whether ProductID is or is not 1.

            I prefer the method DaSaint has recommended for several reasons:

            A) Set Field is better than Insert Calcualted result--it is less affected by future changes to your layout. (Insert steps do not work if the field is not present on the current layout.)

            B) go to portal row cannot specify the portal. It selects the portal row of whatever portal has the focus (and you may mave more than one portal on your layout). You have to use go to object to put the focus on the correct portal when you have more than one portal on your layout and choose to use this step.

            • 3. Re: Script to add info to a portal

              Thanks that helped a lot!