Jump to content
imdarek

Applescript Error to create new record

Recommended Posts

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
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

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

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

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


×

Important Information

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