Change Lead "created date" when assign it to user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Riad
    Member
    • Aug 2018
    • 36

    #1

    Change Lead "created date" when assign it to user

    Hello,
    1- I want to Change Lead "created date" when assign it to user. So the created date of the Lead will be the same date of assign.
    2- As Admin with mass update want to make lead unfollow for any user I want. (Can change lead Followers)
    Thank you
    Last edited by Riad; 04-09-2025, 01:41 PM.
  • rabii
    Active Community Member
    • Jun 2016
    • 1347

    #2
    1- you can use before script formula under Administration > entity manager > lead > formula > before save custom script (use the code below)

    PHP Code:
    if(entity\isAttributeChanged('assignedUserId') && assignedUserId) {
        
    createdAt datetime\now();


    This code will update the created at date to now() date once the assigned user is changed and there is an assigned user.

    2- check this out it might help

    https://forum.espocrm.com/forum/gene...tion-for-users
    Rabii
    EspoCRM & Web Dev

    🔗 See what I’ve built for EspoCRM

    Comment


    • rabii
      rabii commented
      Editing a comment
      The if(){} has been introduced in version 7.4 so any version below this you should use the old formula ifThen instead. check documentation.

    • Riad
      Riad commented
      Editing a comment
      Can you type the the correct formula for v. 7 Please. Thank you

    • Riad
      Riad commented
      Editing a comment
      ifThen(
      and(
      entity\isAttributeChanged('assignedUserId'),
      assignedUserId
      ),
      createdAt = datetime\now()
      )

      This not work
  • lazovic
    Super Moderator
    • Jan 2022
    • 1187

    #3
    Hi Riad,

    Please try to use the following formula script:
    Code:
    ifThen(
      entity\isAttributeChanged('assignedUserId') && assignedUserId,
      createdAt = datetime\now()
    );

    Comment

    Working...