To create a reminder for a task, the ProcessTaskItem.createReminder method.
// Get the task object let task = await System. processes._searchTasks().where(x => x.__id.eq(taskUUID)).first();
// If the task object is not found, stop the script execution if (!task) {
return;
}
// Get the current user const user = await System.users. getCurrentUser();
// Get the current date and add one day to it // The time zone is taken from the `System.timezones.current`field let dateReminder = new Datetime();
dateReminder = dateReminder.add(new Duration( 1, 'days'))
// Create a reminder for the task on the next day await task. createReminder(dateReminder, user);
Link target namespace (the code of the app's workspace).
Methods
delete
delete(): Promise<void>
Delete a reminder.
In the example, a task search is performed, reminders for the current user are retrieved, and all reminders are deleted:
// Get the task object let task = await System.processes._searchTasks().where(x => x. __id.eq(taskUUID)).first();
//If the task object is not found, stop the script execution if (!task) {
return;
}
// Get the current user const user = await System.users.getCurrentUser();
// Get the current date // The time zone is taken from the field `System.timezones.current` let dateReminder = new Datetime();
// Get all reminders for the user for this taskconst reminders = await System.reminders.search().where((f,g) => g.and(f .user.eq(user), f.__item.eq(task!))).all();
// Delete all reminders for ( let i = 0; i < reminders.length; i++) {
await reminders[i].delete();
}
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents).
For example, you can call this method after bulk editing data within an object.
const app1 = await Context.data.app1.fetch();
const app2 = await Context.data.app2 .fetch();
app1.data.executors.push(app2.data.executors);
app1.normalize();
// Now we need to go over the elements in the new array
app1.data.executors .forEach( ... );
Reminder object
To create a reminder for a task, the
ProcessTaskItem.createRemindermethod.// Get the task object let task = await System. processes._searchTasks().where(x => x.__id.eq(taskUUID)).first(); // If the task object is not found, stop the script execution if (!task) { return; } // Get the current user const user = await System.users. getCurrentUser(); // Get the current date and add one day to it // The time zone is taken from the `System.timezones.current`field let dateReminder = new Datetime(); dateReminder = dateReminder.add(new Duration( 1, 'days')) // Create a reminder for the task on the next day await task. createReminder(dateReminder, user);Type parameters
I: Item<ItemData>
Hierarchy
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly data
Values of object’s fields.
Readonly fields
Description of the object’s fields.
Readonly id
ID of the URL’s target.
Readonly namespace
Link target namespace (the code of the app's workspace).
Methods
delete
Delete a reminder.
In the example, a task search is performed, reminders for the current user are retrieved, and all reminders are deleted:
// Get the task object let task = await System.processes._searchTasks().where(x => x. __id.eq(taskUUID)).first(); //If the task object is not found, stop the script execution if (!task) { return; } // Get the current user const user = await System.users.getCurrentUser(); // Get the current date // The time zone is taken from the field `System.timezones.current` let dateReminder = new Datetime(); // Get all reminders for the user for this task const reminders = await System.reminders.search().where((f,g) => g.and(f .user.eq(user), f.__item.eq(task!))).all(); // Delete all reminders for ( let i = 0; i < reminders.length; i++) { await reminders[i].delete(); }Returns Promise<void>
fetch
Request complete data of a reference object.
Returns Promise<ReminderItem>
normalize
Delete duplicate data in arrays.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents). For example, you can call this method after bulk editing data within an object.
const app1 = await Context.data.app1.fetch(); const app2 = await Context.data.app2 .fetch(); app1.data.executors.push(app2.data.executors); app1.normalize(); // Now we need to go over the elements in the new array app1.data.executors .forEach( ... );Returns void
Feedback sent successfully
Thank you for your input