Announcement

Collapse
No announcement yet.

How can I automatically assign a user to a contact?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vadym
    replied
    You're welcome!

    Leave a comment:


  • JosNas
    commented on 's reply
    I feel stupid haha. Sorry didn't notice that thanks a lot Vadym! It worked

  • Vadym
    replied
    JosNas,

    This Formula must be in the Action -> Execute Formula Script. Not in the Conditions.

    Code:
    $userName = string\match(emailAddress, '/([^@]+)/');
    $password = password\generate();
    $hash = password\hash($password);
    $userId = record\create(
    'User', 'userName', $userName, 'lastName', $userName, 'password', $hash, 'emailAddress', emailAddress);
    assignedUserId = $userId;
    assignedUserName = $userName;
    Last edited by Vadym; 12-02-2021, 02:32 PM.

    Leave a comment:


  • JosNas
    replied
    This is the workflow that creates the user. I need this because this is what will give every User <-> Contact access to their own record (User X can edit only Contact record X but can also view others)
    Attached Files

    Leave a comment:


  • Vadym
    replied
    Hi JosNas,

    Provide a screenshot of the Workflow.

    Leave a comment:


  • JosNas
    replied
    Bumping this

    Leave a comment:


  • JosNas
    replied
    Vadym Hi Vadym, thanks for your reply but it still didn't work. If you go to Contacts > Click on the created Contact (open his details view) > `Assigned User` Field on the right panel is still 'None'
    Attached Files
    Last edited by JosNas; 12-01-2021, 12:12 PM.

    Leave a comment:


  • Vadym
    replied
    Hi JosNas,

    Code:
    $userName = string\match(emailAddress, '/([^@]+)/');
    $password = password\generate();
    $hash = password\hash($password);
    $userId = record\create(
    'User', 'userName', $userName, 'lastName', $userName, 'password', $hash, 'emailAddress', emailAddress);
    assignedUserId = $userId;
    assignedUserName = $userName;

    Leave a comment:


  • JosNas
    started a topic How can I automatically assign a user to a contact?

    How can I automatically assign a user to a contact?

    I have a workflow that creates a User once a Contact is created. (Formula is below, and Target Entity is Contact)

    Code:
    $emailAddress = string\substring(entity\attribute(emailAddress), 0);
    $userName = string\match($emailAddress, '/([^@]+)/');
    $password = password\generate();
    $hash = password\hash($password);
    $userId = record\create(
       'User', 'userName', $userName, 'password', $hash 'emailAddress', $emailAddress );
    How can I assign this User that I just created to the Contact that triggered its creation?? I tried many things including
    Code:
    assignedUserId = $userId
    but nothing worked till now (the Assigned User is not being shown in 'Assigned User' field in the Contact record)
Working...
X