AppScript Functions

/* * Special functions are available in all AppScripts * A function takes parameters in the form of strings or integers * Functions may return a List, a Map, or nothing (void) * Groovy also provides a collection of its own functions */ /* * save("Table", ["Field": "Value"]); * Create a record in a table * Return type is a Map of created record */ Map record = save("Table", ["Field": "Value"]); /* * update(Record); * Update a record that has been loaded * Return type is void */ Map record = loadRecord("Table", "Field", "Value"); record["Field"] = "NewValue"; update(record); /* * delete(Record); * Delete a record that has been loaded * Return type is void */ Map record = loadRecord("Table", "Field", "Value"); delete(record); /* * addChild("Child Table", "Relationship. Name", ["Record Field": "Value"]); * Adds a record Map to a child table * Return type is void */ addChild("Child Table", "Link to Parent", ["Field": "Value"]); /* * getChildren("Child Table", "Relationship. Name"); * Loads the children for the triggered record * Return type is List */ List children = getChildren("Child Table", "Link to Parent"); /* * loadRecord("Table", "Field", "Value"); * loadRecord("Table", ["Field": "Value", "Field": "Value"]); * Loads a record matching a single field, or a Map of fields * Return type is Map */ Map record = loadRecord("Table", "Field", "Value"); Map record = loadRecord("Table", ["FieldOne": "Value", "FieldTwo": "Value"]); /* * find("Table", "Field", "Value"); * find("Table", ["Field": "Value", "Field": "Value"]); * Loads a List of records that match the values * Return type is List */ List records = find("Table", "Field", "Value"); List records = find("Table", ["FieldOne": "Value", "FieldTwo": "Value"]);