AnsweredAssumed Answered

Setting default values for text, date, people and group fields

Question asked by alandau on Nov 17, 2016
Latest reply on Nov 22, 2016 by alandau
We are looking to set defaults on a few fields and it is not clear how to accomplish this using Kickstart.

Text box – Set a default text
Date – Set to today's date or a date in the future
People – Set to the current logged in user
Group – Set to a default group

In the formRendered JS we have included

var test = "this is a test string";
var currentUser = scope.$root.account;

for (var fieldArrayIndex = 0; fieldArrayIndex < scope.allFormFields.length; fieldArrayIndex++) {
    var field = scope.allFormFields[fieldArrayIndex];
    console.log(field.id + ' ' + field.value + ' ' + field.type);
    if (field.id === 'mytextfield') {
        field.value = test;
    }

    if (field.id === 'mypersonpicker') {
        field.value = currentUser;
    }
}  

The same form is used on both the start node and human task.  In both cases it is blank.  When the task loads you can see the value set from the previous form, but then it is blanked out when it gets to code.


Outcomes