We have built a custom function to set the due date based on the current date/time, we are using the setFieldValue and it is returning an error:
DFFS: Configuration error in “Run these functions / trigger these rules”. Ensure you use the correct function name or rule friendly name.
The rule “Due Date” tried to invoke the function:
“setDuedate”
Error:
TypeError: a.newVal.split is not a function
Here is our function:
setDuedate = function(priority){
var duedate = new Date();
if(priority == “Critical”){
var temp;
if(duedate.getHours() <= 12){
temp = 17;
}else{
temp = created.getHours() – 4;
duedate.setDate(duedate.getDate()+1);
}
duedate.setHours(temp);
}else if(priority == “Urgent”){
duedate.setDate(duedate.getDate()+1);
}else if(priority == “Basic”){
duedate.setDate(duedate.getDate()+2);
}else{
duedate.setDate(duedate.getDate()+10);
}
if(duedate.getDay() === 0){
duedate.setDate(duedate.getDate()+1);
}else if(duedate.getDay() == 6){
duedate.setDate(duedate.getDate()+2);
}
setFieldValue(“SLA_x0020_Due”,duedate);
};
can you help debug this one?