App Script Cheat Sheet
Find examples of many common operations and tasks
- Update a value on the triggered record
currentValues["Customer"] = "John Smith";
currentValues["Age"] = 123; - Update a value on the parent record
currentValues["Link to Parent"]["Parent Status"] = "Active";
currentValues["Link to Parent"]["Parent Amount"] = 123; - Update a value on the grandparent record
currentValues["Link to Parent"]["Link to Grandparent"]["Grandparent Address"] = "123 Main Street";
currentValues["Link to Parent"]["Link to Grandparent"]["Grandparent Zipcode"] = "12345"; - Fetch a value from a parent record
String parentStatus = currentValues["Link to Parent"]["Status"];
Int masterZip = currentValues["Link to Parent"]["Zipcode"]; - Add a child record to parent record
addChild("Child Table", "Relationship Name", ["name":"John Smith", "Age":42]); - Update a value in a child record
List<Map> children = getChildren("Child Table", "Relationship Name");
children.each { child ->
if(child["Name"] == "John Smith Jr.") {
child["Age"] = 12;
}
} - Print a value on each record in a List
List<Map> children = getChildren("Child Table", "Relationship Name");
children.each { child ->
logger.info(child["Field"].toString())
} - Update a field in every child record
List<Map> children = getChildren("Child Table", "Relationship Name");
children.each { child ->
child["Parent Name"] = "John Smith"
} - Create 5 child records
(1..5).each { index ->
addChild("Child Table", "Relationship Name", ["Child Number": index]);
} - Set an application user field on a record
Map user = loadRecord("Account Users", "Email", "johnsmith@email.com");
currentValues["Assigned User"] = user; - Set a group on a record
Map group = loadRecord("XVIA_USER_GROUP", "group_name", "GroupA");
currentValues["Assigned Group"] = group
Comments
0 comments
Please sign in to leave a comment.