Hello all,
I’m just starting to learn how to use scripts in TapForms 5. I do have some knowledge of Javascript from a web programming perspective.
I thought I’d start with something simple such as create a button that deletes a record. I created the button, and assigned the following script which gets the current record, and then attempts to delete it:
function delete_record() {
// get current record
var thisRecord = record.getId();
// delete the record
form.deleteRecord(thisRecord);
}
delete_record();
The console reports: “deleteRecord: TypeError: Argument does not match Objective-C Class, line:(null)”
I’m sure I’m doing something really noob here such as combining a record function with a form function.
Thanks in advance.
You can just pass in record into the deleteRecord()
function. The getId()
function returns the string ID of the record, but the deleteRecord()
function requires an actual record object.
Don’t forget to call form.saveAllChanges()
too.
Thanks Brendan,
For anyone who is looking this up in a search, this is the working code:
function delete_record() {
form.deleteRecord(record);
form.saveAllChanges();
}
delete_record();
-
This reply was modified 2 days, 23 hours ago by
grooveagent.