Set Employee to the Logged In User

👨🏻‍🏫 Automatically assign the current user as an employee.

1. Set Employee to the Logged In User

This Interaction is designed to set the employee field to the logged-in user's employee ID when a specific condition is met.

1.1. Example

When this Interaction is executed, it sets the employee field to the logged-in user's employee ID when adding a new entry in the record.

async function handler(clev) {
    let actions = [];
    const currentRole = clev.getCurrentRole();
    const employeeId = currentRole.employeeId;
    
    actions.push(clev.setValue("employee", [`${employeeId}`]));

    return clev.mergeAll(actions);
}

2. Populate a Field from Another Field

This Interaction is designed to populate the 317-hours-to-bill field with the field's value when a specific condition is met.

2.1. Example

When this Interaction is executed, it populates the 317-hours-to-bill field with the value of the duration field when the field is updated.

async function handler(clev) {
    let actions = [];
    let duration = clev.getValue("duration");

    actions.push(clev.setValue("317-hours-to-bill", duration));

    return clev.mergeAll(actions);
}

📌 Need Help?

If you require assistance or encounter any issues, please don't hesitate to contact us for further support.