Skip 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.

Would like a validation step in my script

Featured Replies

Hi everyone,

I'm new to the forums and glad to be here!

My issue:

I've written a script (and attached it to a button) that goes like this:

SetVariable

Go to Layout

New Record/Request

Set Field

Perform Script

It's totally functional, but the trouble is, I have a field on the layout that I want to set as "required" so that the script won't run if the field is empty. I would ideally have a custom dialogue box pop up saying, "An e-mail address is required" if that field is empty. The user would then be able to click "OK" [thus cancelling this instance of the script] and go back to fill the field.

I don't want to set the field as required in the field options validation menu, because then it would not be part of the script steps. I tried this, and the script seemed confused.

What script step can do this?

Thank you in advance!

Start your script with

If IsEmpty(requiredfield)

Show custom dialog (with necessary info)

Halt script

Else

then continue with your script

End if

[and welcome to the forums].

Edited by Guest

  • Author

Ah, so that's how the "If" and "Else" work! Thank you--I'm learning a lot, and my script now runs perfectly. :

My preference would be slightly different:


If IsEmpty(requiredfield)

  Show custom dialog (OK)

  Exit script

End if

#

Now continue with your script

Why?

1. The "Else" is not needed since we're going to stop the script anyway. This means you don't have to put the rest of your script inside an If statement, which makes it easier to read and maintain.

2. "Halt" is generally best avoided unless you have some particular need for it; use Exit instead.

As John Hodgman would say, "That is all." :

The "Else" is not needed since we're going to stop the script anyway.

Or the Exit Script is not needed since we're going to use Else... :

I completely agree re Halt Script[] - you should never use it unless you're sure you want to force ALL scripts to stop running at that point.

Or the Exit Script is not needed since we're going to use Else...

Sure, but as I said, I prefer to un-nest my scripts where it makes sense to do so.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.