4 Replies Latest reply on Aug 25, 2016 7:52 AM by dtcgnet

    Going nuts trying to Create New Record in Portal.

    D.S.

      Hi there

       

      Spent all morning trying to figure this one out - despite numerous articles I just can't create new records to a portal.

       

      I have a button attached to a script above the portal on the main page. Schematics as such:

       

      Database relationship

      HOME::Home_ID = CheckIn::CheckIn_ID

      Creation of records allowed.

       

      Layout

      Layout: HOME

      Portal table: CheckIn

      Object name for portal: CheckInPortal

       

      Script (Button)

      Go to Object [ Object Name: "CheckInPortal" ]

      Go to Portal Row [ Select ; Last ]

      Set Field [ CheckIn_Timestamp ]

      Commit Records/Requests

       

       

      I want a continually appended-to list of records displayed in the portal.

       

      Any ideas?

       

      Many thanks

        • 1. Re: Going nuts trying to Create New Record in Portal.
          philmodjunk

          What you have should work if the portal has been given the object name shown and it's based on the relationship given. Except that your Set Field step is missing the calculated result parameter such as Get ( CurrentTimeStamp ) and thus is not entering any data into the field to create the related record.

           

          It's not the approach that I would use, however as simple layout changes in the future can break it by inadvertently changing the object name of the portal.

           

          Without adding a special relationship just for adding new records, I'd use:

           

          Set variable [$ID ; value: Home::Home_ID ]

          Go to Layout ["CheckIn" ; (CheckIn) ]

          New Record/Request

          Set Field [ CheckIn::TimeStamp ; Get ( CurrentTimeStamp) ]
          Set Field [ Checkin::CheckIn_ID]
          Go to Layout [Original Layout]

           

          There also seems to be a typo in your original post so I am guessing a bit when it comes to the correct tableOccurrenceName::FieldName format for referring to fields in your portal's table.

          1 of 1 people found this helpful
          • 2. Re: Going nuts trying to Create New Record in Portal.
            coherentkris

            You could also accomplish the same thing with the "magic key" method of creating related records.. advantage is that with MK you don't have to sweat any script triggers that may be attached to the portal fields.

            1 of 1 people found this helpful
            • 3. Re: Going nuts trying to Create New Record in Portal.
              D.S.

              Excellent - works perfect. Thanks!!

              • 4. Re: Going nuts trying to Create New Record in Portal.
                dtcgnet

                Script (Button)

                Go to Object [ Object Name: "CheckInPortal" ]

                Go to Portal Row [ Select ; Last ]

                Set Field [ CheckIn_Timestamp ]

                Commit Records/Requests

                 

                In this original script, your Set Field statement doesn't provide anything for the VALUE of CheckIn_Timestamp. As a result, no data was passed to the new record which would prevent it from being created. A Set field without a value will result in Error 5: "Command is invalid (for example, a Set Field script step does not have a calculation specified)".

                 

                Glad you got it working.