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.

Duplicate Record / Request not working in a script

Featured Replies

I have a simple script to duplicate the current record. But, the record is not duplicated. No error is shown, even with error capturing off. But if I debug, I see it is returning error 3 - “Command is unavailable (for example, wrong operating system, wrong mode, etc.) “.

If I use the duplicate record in the menu, it works fine. Also, the script steps works fine in other files, just not this one..

I have full access rights to the file.

Any ideas ?

Okay, how about posting the script?

  • Author

The script is attached. Very simple as you can see.

My colleague has discovered that adding a script step Goto Field before the Duplicate Record / request seems to fix the problem. If I use Goto Layout instead of Goto field, it does not work.

But I really don't see why I should have to do either of those, does not seem to me to make sense. I just want to duplicate the current record.

Duplicate.pdf

The only way I could produce similar results is when the file is in PREVIEW mode prior to the duplicate record command - this is a "wrong mode" situation.

Don't understand about the go to field or layout.

  • Author

Well it does not seem to make any sense that I have to use the goto field step first to make a duplicate record step work, but anyway, it does work. Thanks.

Can you post a simple file that shows the problem?

  • Author

OK, I deleted most of the tables and layouts.

Go to documents, then record number 13 "This one".

The "use Template" button will appear because the document type contains the word "template".

The "Use Template" button runs the script "Create Document from Template".

If the GOTO Field step before Duplicate Record is disabled, the record will not duplicate.

Admin PW is blank

Dup_Prob.zip

I don't see any "Use Template" button. If I run the script from the Scripts menu, it duplicates the record just fine. I suspect you have some interference from a plugin.

  • Author

The "use Template" Button is just below the notes / comments, to the right of the image. It will only appear if the document type contains "Template".

You are correct - it does indeed run properly when the script is run directly from the scripts menu. But it does not work when I use a button.

You have suggested interference from a plugin... any idea what plugin could cause this ?

I see no such things in the posted file (the layout is 'Digital Media list'). I suggest you disable all plugins and start from there. Event-triggering is the most likely suspect, but this is purely speculating.

  • Author

The layout is digital media DETAIL. I have a LOT of plugins installed, many of them demos of stuff I tried. I guess its time to clean up anyway..

But I would still love to know if you get the same behaviour.

I do.

Your button is in a portal. When you click on it, you enter a portal row. The script keeps running in that context. If it were allowed to, it would duplicate the related record in that portal row (says so in the help).

You should start your script with Go to Field[] or Commit Records to get out of the portal.

  • Author

aha. yes it is indeed in a portal, so that it can be hidden when its not supposed to be available.

Thanks so much for your help.

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.