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.

Preventing duplicates when creating new records using Set Variable

Featured Replies

  • Newbies

Hello. 

I have two tables: Person and Recruiting

Within Person, I have a field Person::Source (which indicates the recruiting event we first met the person)

Withing Recruiting, a record is created for each recruiting event. 

I have the Person::Source field set to run the following script each time I enter a new Person record, which then creates a new Recruiting record

Freeze Window

Set Variable [$Source; Value: Person::Source]

Go to Layout ["RecruitingList" (Recruiting)]

New Record/Request

Set Field [Recruiting::Recruiting Event; $Source]

Go to Layout [original layout]

The problem I am having is that we have several Person records with the same Person::Source value, and each time I run the script is creates duplicate records in Recruiting. Is there anything I can add to the existing script that will prevent the new record from being created if it the record already exists? 

 

 

 

Edited by Lee Smith
Removed the Red Text

I would start by defining the Recruiting Event field to validate as Unique.

Then make your script:

Freeze Window
Set Variable [$Source; Value: Person::Source]
Go to Layout ["RecruitingList" (Recruiting)]
Set Error Capture [ On ]
New Record/Request
Set Field [Recruiting::Recruiting Event; $Source]
Commit Records/Requests
If [ Get ( LastError ) = 504 ]
  Revert Record/Request [ No dialog ]
End If
Go to Layout [original layout]

 

  • Author
  • Newbies

Hello Comment, 

This worked perfectly! The Unique validation tip also helped me figure out another issue I was having. Thank you very much!

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.