Jump to content

Trigger a script


This topic is 2945 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

 

I'm new to Filemaker and I'm working my way through it. I've created a form layout to add data. I've created a script that takes static data from a template table and loads it into specific fields on my layout. When I trigger the script to run from the scripts menu it runs fine and does as I need it to.

 

However, I need it to run automatically when someone creates a new record using an ipad / computer. How do I get this to happen as I can't seem to figure it out and I can't find anything on here that tells me either.

 

Thanks

Ann

Link to comment
Share on other sites

FM has a number of events you use to trigger scripts, but from what you are saying, it does not sound like you would want to do it when a record gets created (because it does not contain any data at that point).  You can use onRecordCommit, but then you have to make sure you handle all the scenarios where FM automatically commits (which could happen before the user is ready with the record).

So the easiest solution is not to use events and triggers but use a plain old button on the layout that the users can click when they are ready to submit the data.

Link to comment
Share on other sites

Hi Wim,

 

I do want it to populate when they create a new record so that they can edit the information (make text bold / italics depending on the observation they are making. These changes are then saved in the record also. I need to make the record in the first place. I've tried adding a button on the layout to create a new record (works fine) but the script (onObjectEnter trigger) doesn't do anything.

 

What is it I'm doing wrong?

Link to comment
Share on other sites

There is no OnNewRecord script trigger. Your best option, IMHO, is to script the creation of new records completely and remove the possibility of creating new records manually.

 

Alternatively, you could trigger a script OnRecordLoad and populate the fields only if the record is new - i.e. when Get(RecordOpenState) = 1. But that's wasteful.

 

Another option worthy of consideration is defining the field to auto-enter the default values (requires setting up a relationship between the two tables, though).

 

---

P.S. Users should not record their observation by changing the text formatting. Text formatting is not data and it will be very difficult to process it in any useful way..

Link to comment
Share on other sites

This topic is 2945 days old. Please don't post here. Open a new topic instead.

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
 Share

×
×
  • Create New...

Important Information

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