want to do Work notemandatory within a PTASK when Due date & Follow up date are updated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 07:13 PM
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"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 08:12 PM
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);
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 08:18 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 08:24 PM
it is working fine for me in my PDI. for new records and existing records for due date.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 08:34 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 08:41 PM
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);
}
}
Harish