Imagine that on the model, we have the following model variables:
Collect and set the values after:
You can also find more examples on how to create Processes here.
- Month.Current Month
- Year.Current Year
JavaScript:
function pre() {
//this function is called once before the processes is executed.
//Use this to setup prompts.
const monthNames = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
];
const now = new Date(Date.now());
const monthNow = monthNames[now.getMonth()]; // Default month
const yearNow = now.getFullYear().toString(); // Default year
script.prompt('Month.Current Month', 'currentMonth', monthNow);
script.prompt('Year.Current Year', 'currentYear', yearNow);
script.log('process pre-execution parameters parsed.');
}
Collect and set the values after:
JavaScript:
function begin() {
//this function is called once at the start of the process
script.log('process execution started.');
script.variableSet('Month.Current Month', currentMonth);
script.variableSet('Year.Current Year', currentYear);
}
You can also find more examples on how to create Processes here.
Last edited: