3 Replies Latest reply on Dec 4, 2013 6:21 AM by FredBloggs

    Create new record on portal by script

    RedL

      Title

      Create new record on portal by script

      Post

      We have two portals in Payment layout.  One is PaymentDetail.  The other is Invoice.  Both are linked to Payment table.  When user select Invoice Portal row, we need to create and copy it to PaymentDetail portal by script.  How can we create portal row by script without leaving current layout?  Currently, we jump to the other layout which is dedicated to PaymentDetail, and create a new record.  From data point of view, it works. But, we cannot use Revert command which is associated with Payment Layout.  Because, after create new record on PaymentDetail layout and exit, the record will be committed.

      1.jpg

        • 1. Re: Create new record on portal by script
          philmodjunk

          I don't think the revert command will work after interacting with the portal either. You can try it and see for your self if you want:

          Give the payment detial portal a unique object name (Name box at top of position tab in Inspector). I'll assume you have named it "PaymentDetail".

          Set variable [Data$ ; value: AR_Invoice::Data ] //don't know exactly what data you need to copy from one invoice to the other here
          Go To Object ["PaymentDetail"]
          Go To Portal Row [Last] //must have "allow creation of records..." enabled for AR_ARDetail in AR_AR to AR_ARDetail relationship
          Set Field [AR_ARDetail::Data ; $Data ]

          I predict that you will have trouble here with Revert as well. You may need instead to have a "delete" button in the portal row that is used to delete the portal row.

          • 2. Re: Create new record on portal by script
            RedL

            Thanks.  It works.  And the Revert works as well.  I have blank web viewer which you posted for my question before. - http://forums.filemaker.com/posts/acde6ab51f

            • 3. Re: Create new record on portal by script
              FredBloggs
                   

              Go To Portal Row [Last] //must have "allow creation of records..." enabled for AR_ARDetail in AR_AR to AR_ARDetail relationship

              idée You also need to turn the scroll bar on in your portal display - if not, weird things start happening clin d'oeil