Used to create substitutions.
The method initializes a new substitution.
After specifying substitution details you need to save the substitution by calling the ReplacementItem.save mehtod.
// Let's create a substitution for an employee who is going on holiday const rpl = System. replacements.create(); rpl.data.type = rpl.fields.type.variants.reassign; rpl.data.absent = Context.data.__createdBy; rpl.data.replacement = Context. data.substitution; rpl.data.begin = Context.data.vacation_start; rpl.data.end = Context.data.vacation_end; await rpl.save();
The method searches for substitutions.
To search for items in the collection, use the Search object:
const replacements = await System.replacements.search() . where(r => r.absent.eq(Context.data.absent_user)) .all();
Read more about using search in the article about the user search object.
Your review is successfully sent!
Feedback sent successfully
Substitution object
Used to create substitutions.
Hierarchy
Properties
Readonly rules
Substitution rule object.
Methods
create
The method initializes a new substitution.
After specifying substitution details you need to save the substitution by calling the ReplacementItem.save mehtod.
// Let's create a substitution for an employee who is going on holiday const rpl = System. replacements.create(); rpl.data.type = rpl.fields.type.variants.reassign; rpl.data.absent = Context.data.__createdBy; rpl.data.replacement = Context. data.substitution; rpl.data.begin = Context.data.vacation_start; rpl.data.end = Context.data.vacation_end; await rpl.save();Returns ReplacementItem
search
The method searches for substitutions.
To search for items in the collection, use the Search object:
const replacements = await System.replacements.search() . where(r => r.absent.eq(Context.data.absent_user)) .all();Read more about using search in the article about the user search object.
Returns ReplacementSearch