Expand an option to learn more...

//Create date variable
Date theDate = currentValues[“Date Field”] as Date

//Create calendar variable for date manipulation
Calendar calendar = Calendar.getInstance()

//Set calendar date to date variable
calendar(theDate)

//Add one month to date
calendar.add(Calendar.MONTH, 1)

//Set calendar date to the first day of the month
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH))

//Set date variable equal to the calendar variable
theDate = calendar.getTime()

//Set date field to the new date
currentValues[“Date Field”] = theDate

//Use a list for the checkbox field
List checkbox = currentValues[“Checkbox Field”] as List

//Check South as a checkbox option
checkbox.add(“South”)

//Uncheck East as a checkbox option
checkbox.remove(“East”)

//Set the new value of the checkbox field
currentValues[“Checkbox Field”] = checkbox

//String value that a form populates
String salesPerson = currentValues[“Sales Person”]

//Field doesn’t have a value and that’s a problem
if(salesPerson == “”){
// Exception will display as a toaster when form is submitted
throw new RuntimeException(“Sales Person must have a value.”)
}

//Fields from a State table accessed from the side panel.
int governor = 24930;
int dateInactive = 24974;

//Note how the variables take the place of hardcoded values
if(currentValues[governor] && (currentValues[governor] != previousValues[governor])){
currentValues[“Previous Governor”] = currentValues[governor]
}

def addOne(int input) {
return input + 1
}

int myNumber = 0
myNumber = addOne(myNumber)