want to do Work notemandatory within a PTASK when Due date & Follow up date are updated

raj765_32
Tera Contributor

Hi can anyone help me with the code for making the work notes mandatory when due date and follow up date is updated in p task form.

 

 

When a user inserts a value within the "Due date' and "Follow up date" field of a PTASK, on save or update of the form, make "Work notes" field mandatory

Throw out a message that reads:

"Work notes field requires a values to save the form"

14 REPLIES 14

modify the script like below to work on new records

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if (g_form.isNewRecord()) {
alert("worknotes Mandatory");
g_form.setMandatory('work_notes', true);
return;
}
}
var getDueDate = g_form.getValue('due_date');

if (getDueDate != oldValue) {
alert("worknotes Mandatory");
g_form.setMandatory('work_notes', true);
}

}

Regards
Harish

no it is not working, do you have any idea on how do make mandatory by display business rule and calling that business rule through scratch pad in client script 

 

in business rule we can add a condition for when due date changes

it is working fine for me in my PDI. for new records and existing records for due date.

Regards
Harish

for new records i should not get alert and set work notes mandatory, i should get alert only when they update due date and follow up date and make wknotes mandatory

ah ok then remove alert when it is new record, modified below

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if (g_form.isNewRecord()) {
g_form.setMandatory('work_notes', true); // set worknotes mandatory no alert required
return;
}
}
var getDueDate = g_form.getValue('due_date');

if (getDueDate != oldValue) {
alert("worknotes Mandatory");
g_form.setMandatory('work_notes', true);
}

}

Regards
Harish