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.

Conditional create record, with find button.

Featured Replies

I need a script that will either go to a related record, or create a new record if no related record exists.

The application is a job that has 3 componets, I need 3 buttons 1 for each component that will be "goto / create" buttons. For the details held in each of the component tables.

Can someone suggest a script to do this?

Thanks

Daniel

.. im a bit confused... but for the if no related record create new... (im assuming you want to create it in the original table and go back to the original layout...)

SetErrorCapture (On)

Goto Related Record (bla bla bla bla)

If (GetLastError) = 0

GotoLayout (Back to original layout)

Else

Create New Record / Request

End If

  • Author

I am in table 1 - I want to go to the related record in table 2, if it exists, if not I want to create a record in table 2 that is related to the record in table 1.

Table 1 holds some initial details about a booking, with the rest being filled in table2. The will only ever be one related record in table 2 for one record in table 1.

Initially to create the record I set a veriable to the ID in table1 , went to table 2 and set the field to that value, hence creating a related record. I set that field to have to be unique, to prevent two booking records being created.

I then had another button, to go to table2 nd search on the ID from table1. ie "goto booking". It would be nice to place the functionality in one button.

Thanks for the script I will give it a go!

  • Author

ok, see the logic, but I can't work out how to input the "If (GetLastError) = 0" part of the script. If I select If in the calculation field i get "The specified table cannot be found"

help!

  • Author

ok, got it finally found it in the calculations whn sorted by type.

... no no... you want a button ok... and attach the following script to it... or close to it anyway... im paraphrasing scripting here...:

- SetErrorCapture(on)

- Freeze Window

- SetVariable or Global whatever = your ID

- Goto Related Record (Select the related table occurance and a layout that uses that table...)

- If (GetLastError)(doesnt equal) 0

- Create New Record / Request

- Set Field (Related ID = Your variable or global)

- End If

- Goto Layout (back to where you came from)

... i no its a bit scanny, but its all ive got time for, hope it helps

Genx

  • Author

aflgenx,

sorry for not posting back, actually helped a lot, I have been going over all sorts of scripts to learn how the work.

Its nice to see one that is directly relivent to what I an trying to achive.

Thanks again

Create an account or sign in to comment

Important Information

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

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.