I'am creating task for inactive leads. However, there is a scenario where the lead owner is inactive already. Since 'Assigned to' field in task is a required field, I'm trying to set the default lead owner as the task owner but I haven't find any doc to get this. Is anyone here know how to achieve this or is there any other workaround on this. TIA.


So, while I don't think there is a way to query for the default Lead Owner (you would expect it to be in the LeadConfigSettings) you could do the following:

  • Take the parent Lead and rerun the Assignment rules on that Lead. This will assign the lead to an active user
  • Query the lead post-assignment rules execution to get the Lead.OwnerId and use for the Task

Alternatively, if your Lead Assignment rules are don't have an "otherwise" final rule, construct a temporary Lead with data such that you know it will fall through the entire set of assignment rules (I once used Leads coming from Country = Diego Garcia), thus being assigned to the default lead owner. Query the Lead for the ownerId, then delete the temporary Lead and use the ownerId for the Task

Lastly, and an approach a lot of people would do is to define the username of the default lead owner in a custom setting, label, or custom metadata and query that user to get the ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.