Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5605 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted (edited)

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
Posted

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." :

Posted

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.

Posted

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.

This topic is 5605 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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