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); 

Type parameters

Hierarchy

Properties

Readonly code

code: string

App code of the URL’s target (the app’s code).

Readonly data

data: Based<Partial<ReminderData>>

Values of object’s fields.

Readonly fields

fields: Readonly<object>

Description of the object’s fields.

Readonly id

id: string

ID of the URL’s target.

Readonly namespace

namespace: string

Namespace of the URL target (the code of the workspace that the app belongs to).

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  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

normalize

  • normalize(): void
  • 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