Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Check Portal rows without the last blank row

Featured Replies

Hello,

 

I would like to create a script when there is a field that is empty it's show a custom dialog.

The only thing i'm struggling with is the blank row the portal creates.

 

This the script i have:

 

Go To Portal Row [select; First}

Loop

If [isEmpty ( article::Number)]

Show Custom Dialog ["No Article";"No Article"]

      If [Get ( LastMessageChoice ) = 1]

      Exit Script[]

      End If

Else If [isEmpty ( Article::Description )]

Show Custom Dialog ["No Description";"No Description"]

     If [Get ( LastMessageChoice ) = 1]

      Exit Script[]

      End If

End If

Go to Portal Row [last]

End Loop

Make 2 relationships, one that is allowed to create records( in which you already have ) and one that is not

Use the one that is not allowed to create related records in this script.

The only thing i'm struggling with is the blank row the portal creates.

 

I'm not sure I understand the issue. Are you saying that the script creates a new related, empty record – or that there is an empty last row in the portal?

 

The former can't be true, because you cannot create a related record simply by looping through portal rows, and there is nothing in the script that sets a value into a related field (or any field, for that matter) – which would be a prerequisite for creating a related record in a portal.

 

The latter would be simply the spare row you see when you check “Allow creation of related records …” in the relationship definition. 

 

Make 2 relationships, one that is allowed to create records( in which you already have ) and one that is not

 

It would be better to write a proper script that uses Go to Portal Row [ next ], instead of last.

 

This will also adds the as-of-yet missing exit condition; though it wasn't mentioned by the OP, normally the script as shown should fall into an infinite loop.

 

Here's a (hopefully) better version, with an alternative ending for avoiding the spare portal row if there is added something to the script that does write a value.

# Set Variable [ $countRelated ; Count ( PortalTO::primaryKey ) )
# If ( not $countRelated ) ]
  # Exit Script
# End If
Go to Object [Object Name: "myPortal"]
Go to Portal Row [Select; First]
Loop
  If [// some condition]
    Show Custom Dialog ["Title"; "Message"]
    #1 = end, 2 = proceed
    If [Get ( LastMessageChoice ) = 1]
      Commit Records/Requests []
      Exit Script []
    End If
  Else If [// some other condition]
    Show Custom Dialog ["Title"; "Message"]
    #1 = end, 2 = proceed
    If [Get ( LastMessageChoice ) = 1]
      Commit Records/Requests []
      Exit Script []
    End If
  End If
  Go to Portal Row [Select; Next; Exit after last]
  # or: Exit Loop If ( Get ( ActivePortalRowNumber ) = $countRelated // for unfiltered portal only ]
  # Go to Portal Row [Select; Next]
End Loop
Commit Records/Requests []

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.