Page 1 of 1

Copy start date, end date and duration changes to other fields in Task model

Posted: Fri Mar 24, 2023 11:23 pm
by muhabbil

Hi,
In Task Model, we have start date, end date, duration, baselines fields by default, i have added 2 more fields planned start date, planned end date.

What i want to do is, once start, end or duration field is chanced, i want to copy over default fields to other fields and update baselines in front end and after that update event should be fired and it will sync the changes to salesforce backend.

Which event i can use to make these changes so that baseline is visible with latest changes and modified data is sent to backend as i tried these changes in update event but its gives max stack size reached error?

taskRecord.plannedStartDate = taskRecord.startDate,
taskRecord.plannedCompletionDate = taskRecord.endDate,
taskRecord.baselines.getAt(0).startDate = formatDate(taskRecord.plannedStartDate);
taskRecord.baselines.getAt(0).endDate = formatDate(taskRecord.plannedCompletionDate);

[/code]


Re: Copy start date, end date and duration changes to other fields in Task model

Posted: Mon Mar 27, 2023 8:42 am
by alex.l

Hi,

To not have max call stack error, try to check if value needs to be updated before update it. Like

if (taskRecord.plannedStartDate != taskRecord.startDate) {
    taskRecord.plannedStartDate = taskRecord.startDate
}

and so on