Hello everyone,
I’m working on a solution that automatically adds 15 minutes to the StartDate
and assigns this new value to the DueDate
attribute in Creatio. The issue is that although the logs show the correct date (after adding 15 minutes), the DueDate
value is not updating on the page, and I still see the old value.
Here’s my code in the handler:
javascript
handlers: [
{
request: 'crt.HandleViewModelAttributeChangeRequest',
handler: async (request, next) => {
if (request.attributeName === 'StartDate') {
const startDate = request.$context.StartDate;
console.log("StartDate before adding minutes: ", startDate);
if (startDate) {
// Add 15 minutes to StartDate
const newDueDate = new Date(new Date(startDate).getTime() + 15 * 60 * 1000);
console.log("DueDate after adding 15 minutes: ", newDueDate);
// Assign the new value to DueDate
request.$context.DueDate = newDueDate;
// I also tried using $set to update the UI
try {
if (request.$context.$set) {
request.$context.$set('DueDate', newDueDate);
}
} catch (error) {
console.log('Error with $set method:', error);
}
}
}
return next?.handle(request);
}
}
]
- The logs show that the date is correctly calculated, and 15 minutes are added
- However, on the Creatio interface, I see that
DueDate
is not updating.
- Even though I tried using the
$set
method to update the value, it still does not work.
**Has anyone encountered this issue before? How can I ensure that the DueDate
is updated correctly on the interface after modifying StartDate
? Any suggestions would be greatly appreciated!
Thank you in advance!