Update Current Record
Update current record's "Status" and "Amount" fields:
currentValues["Status"] = "Active";
currentValues["Amount"] = 2125.75;
Update Parent Record
Update a linked parent record's "Status" and "Amount" fields:
currentValues["Link to Parent"]["Status"] = "Pending";
currentValues["Link to Parent"]["Amount"] = 1050.99;
Update Grandparent Record
Update a linked grandparent record's "Address" and "Zipcode" fields:
currentValues["Link to Parent"]["Link to Grandparent"]["Address"] = "1675 Larimer Street";
currentValues["Link to Parent"]["Link to Grandparent"]["Zipcode"] = 80202;
Add Children
Create a new child record using relationship to child table with provided record data field, value collection:
addChild("Child Table", "Relationship Name", ["name": "John Smith", "Age": 42]);
Create 5 new child records and update field value for each child based on index
:
(1..5).each { index ->
addChild("Child Table", "Relationship Name", ["Order": index]);
}
Validate Regular Expression
Validates a user's input against a Groovy regular expression:
def validatePattern(Object value, Pattern regex, String errorMessage = "General validation error") {
if(value ==~ regex){
return true;
} else {
throw new RuntimeException(errorMessage);
}
};
def alphaNumeric = ~("^[a-zA-Z0-9]*\$");
validatePattern(value, alphaNumeric);
Comments
0 comments
Please sign in to leave a comment.