addNewTo<>

Will create a new value and add it into the collection. This method is generally called by workitems when you add a new element in CRUD.

This method is generated only for collection of values, ex:

{
  type: 'project',
  values: {
    tasks: 'task[0..n]';
  }
}

Examples

Add a new task entity into the tasks collection, using default values

yield projectAPI.addNewToTasks();

Using a payload for initializing the new task

const payload = {
    subject: 'Clean task',
    description: 'Clean codebase'
};

yield projectAPI.addNewToTasks({payload})