Jump to content
imdarek

Applescript Error to create new record

Recommended Posts

imdarek    0

Hi, I am using filemaker 11 to copy customer info from excel into the database and then it would generate special keys in pdf allowing us to send the file to the customer.

My access to the filemaker is non-admin, and the import function of customer info has been blocked.

We are keying in the record one at a time, so we are looking at ways to automate this process.

When I try to create a new record using applescript with just 

Quote

Create new record

it was not allowed. There are data that require validation like date and auto-indexed record number.

So, is there a way we could create new record and then using the set function to copy data into the report?

Share this post


Link to post
Share on other sites
comment    1,370
3 hours ago, imdarek said:

the import function of customer info has been blocked

What exactly does that mean? Do you have the privilege to create new records in the customers table?

 

3 hours ago, imdarek said:

it was not allowed.

It was not allowed because ...? Please show the exact error message.

 

3 hours ago, imdarek said:

There are data that require validation like date and auto-indexed record number.

I am afraid that's also too vague.

Share this post


Link to post
Share on other sites
Lee Smith    144

Hi Imdarek and welcome to the FM Forums,

You posted this question in the FM Server 11, are these files being served?

On 2/17/2017 at 1:07 AM, imdarek said:

I am using filemaker 11 to copy customer info from excel into the database and then it would generate special keys in pdf allowing us to send the file to the customer.

My access to the filemaker is non-admin, and the import function of customer info has been blocked.

You should contact Admin to see if your Accounts and Privileges can be modified so you can do this.

Share this post


Link to post
Share on other sites
imdarek    0

Hi,

I am using the script editor in Mac itself to create record.

When I create a new record, it shows this error : "Set Data failed.  Invalid data was supplied."

	tell application "FileMaker Pro"
		go to layout "Contract"
		go to (create new record)
	end tell

If I would want to create new record with all the pre-defined fields, leaving out those auto-indexed field and auto-calculated value, it shows "Set Data failed.  Invalid data was supplied."

on Create_Customer_Info(Cust_Info)
	tell application "FileMaker Pro"
		go to layout "Customer"
		tell current layout
				go to (create new record with data Cust_Info)
		end tell
	end tell
end Create_Customer_Info

However, when i create a script in Filemaker to create new record and commit record, I am able to set the field using Applescript however, the additional field that will automatically calculate the field based on the earlier set field does not appear.

Share this post


Link to post
Share on other sites
comment    1,370

I have managed to reproduce the error by defining one of the fields to validate as Not Empty, Validate Always. The user privileges have nothing to do with this: I get the same error when logged in as admin.

Apparently, the create new record event attempts to commit the newly created record and fails due to validation. This is hardly surprising, considering that the entire AppleScript dictionary for Filemaker was created before version 7 introduced the concept of committing records - and no major changes were made since then.

I did manage to work around the problem by using the create new record with data event; however, this requires the fields you want to populate to be positioned above any other fields on the layout. I must say, I was quite surprised by this; I would expect it to populate the fields that are first in the tab order, or the fields that are furthest back on the Z axis. But apparently it just goes from top to bottom.

If you're not able to modify your layout to suit, perhaps you could circumvent the entire issue by using go to (duplicate last record) and then set cell "CustomerName" of current record to "John Smith" etc.

 

6 hours ago, imdarek said:

when i create a script in Filemaker to create new record and commit record, I am able to set the field using Applescript however, the additional field that will automatically calculate the field based on the earlier set field does not appear.

I am not sure what you mean by "the additional field that will automatically calculate the field based on the earlier set field".

I am also puzzled by this: if you can create a script in the target file, then why do you need AppleScript to automate the process? You started by saying that "the import function of customer info has been blocked" - but you still haven't explained how exactly. If you have the privilege to create new records, then you also have the privilege to import them. Perhaps you just don't have access to the menu command, due to custom menus being installed.

 

 

 

Edited by comment

Share this post


Link to post
Share on other sites

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


  • Similar Content

    • By GeoSteven
      I am running a server side script that attempts to update records in a MySQL table that is set up as an external data source. It runs without issue for hours to weeks at a time then gets hung on error 512 (Record was already modified by another user). The problem is that I can't figure out how to capture and handle this error. I've tried adding "If get(lasterror)=512 then <skip this record and continue to next> just after the 'Go to Record(next)' but it never gets to that step. Instead hangs on try to move the record pointer and writing error after error to the log. 
      I've searched the forums fairly thoroughly but there is not a lot of info forthcoming. Surely this has been a problem for someone else that has figured out how to handle it. Any suggestions appreciated.
      Will be glad to provide more info on the environment if needed.
      Thanks in advance,
      Steve
    • By ggt667
      What is wrong when Database appears unavailable to the scheduler, yet regular users are logged in?
    • By ggt667
      Is there a way in AppleScript to trap if the connection is lost and have an AppleScript act on this?
      At the risk of asking and answering myself( AppleScript below )
      repeat tell application "FileMaker Pro" try database "db" on error do shell script "sudo shutdown -r now" with administrator privileges end try end tell delay 59 -- 59 secs end repeat  
    • By Colin Hunter
      I'm running FMS 11.0.5.510 on OS X 10.9.5. It's serving forty databases, one of which is served to the web via custom web publishing. Everything is running smoothly but the campus security auditor is picking up a vulnerability with the old version of OpenSSL running on OS X 10.9.5's Apache. I addressed this on a different, non-FMS Mac by disabling Apple's bundled Apache and using MacPorts to install Apache2.
      How to do this on my FMS 11 Mac? Just getting MacPorts to install Apache2 is the first problem as port install apache2 fails with a conflicting ports message. I assume this is because the existing Apache is blocking installation of the new version but how to stop the existing one? I tried turning off web publishing in the FMS admin console but port install still fails with the familiar conflicting ports message. Even stopping the web server with Mark Banks' FMSControl didn't help.
      I therefore have a couple of questions:
      How do I stop the existing Apache so MacPorts will install Apache2? Once I have Apache2, how do I get FMS11 to use it instead of Apple's bundled Apache1? Thanks
      Colin
    • By ggt667
      How can I get ESS access to PostgreSQL from FM11SA?
×

Important Information

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