Created at takes Id of Logged in User only but modified takes id from array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sapyantuk
    Senior Member
    • Oct 2020
    • 265

    Created at takes Id of Logged in User only but modified takes id from array

    $i = 0;

    while(
    $i < array\length(usersIds),
    (
    $id = record\create(
    'Attendance', 'attendanceDate', date,
    "createdById", array\at(usersIds, $i),
    'modifiedById', array\at(usersIds, $i),
    'test', array\at(usersIds, $i) );



    $i = $i + 1;
    )
    );

    This is the code I used in formula script of entity Holiday,
    When I update holiday, It runs the formula script,
    I have multiple enum for users which is usersids,
    I run the loop to create Attendance for those user.
    I want to have created by field set to the user by assigning id of user,
    same thing work good for modifiedbyid or modified By but It shows logged in user name in created by, Please help


  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    try 'createdById' instead of "createdById" not sure if it will work created by is automatically assigned by the system. a workaround would to update the attendance entity just after the create use (record/update) and loops through the usersId and update it on the entity same as you did on create/record.

    good luck
    Rabii
    Web Dev

    Comment

    Working...