Assign Leads - 504 Gateway Timeout Error

When I try to assign leads to our users (mass Update), let’s say more than 20 leads to a user, the system generates a 504 Gateway Timeout error. I believe, it is sending emails and causing this to happen as it may take time to send emails one by one to the user.

Is there a way to disable this live email send or queue the email send when the leads are assigned, so that cron scheduler system will push the email later on and there is no 504 Gateway error.

Please advise. I can make the script timeout to a longer time, but this is not the actual fix. In reality, email must be queued, not sent instantly.

You need to get the “email send” out of the loop that the UI is waiting for.

I can think of several ways to achieve this, but here’s one without the need for PHP code:

Instead of assigning, create a new custom field called “deferred_assign” and put the name of the assignee user there, during the Mass update. This should be fast because it doesn’t send any emails.

Now make a Workflow on Leads module, All records, allow repeated runs

  • condition: if “deferred_assign” is not empty
  • action 1: assign the record to the specified user (this will send the email)
  • action 2: clear “deferred_assign” field.
1 Like

Awesome, this will work. Thanks for quick reply.