To create a reminder about a task, use 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, finish running the script 
if (!task) { 
 return;  
} 
// Get the current user 
const user = await System.users. getCurrentUser(); 
// Get the current date and add 1 day 
// The time zone  from the `System.timezones.current` field is used 
let dateReminder = new  Datetime(); 
dateReminder = dateReminder.add(new Duration(1, 'days')) 
//  Create a reminder about a task for 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.

    Search for a task, search for reminders for the current user, and delete all reminders:

    // Get the task object 
    let task = await System. processes._searchTasks().where(x => x.__id.eq(taskUUID)).first(); 
    // If the  task object is not found, finish running the script 
    if (!task) { 
     return;  
    } 
    // Get the current user 
    const user = await System.users. getCurrentUser(); 
    // Get the current date. The time zone from the `System. timezones.current` field is used 
    let dateReminder = new Datetime(); 
    // Get  all reminders for the current user about the current task 
    const reminders =  await System.reminders.search().where((f,g) => g.and(f.user.eq(user), f. __item.eq(task!))).all(); 
    // Delete all the 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