+ Start a Discussion
Craig WoodmanCraig Woodman 

Lead conversion with tasks owned by queue

Hello,

I ran into an error with a lead converting - just the generic "Salesforce Error" message.  It was not any of my automations failing as I was receiving no application error.  

I tried a few different things, but then I opened a developer console to capture a debug log.  After digging through, I found this error message:

09:04:41:114 EXCEPTION_THROWN [1579]|System.DmlException: Update failed. First exception on row 1 with id 00T2M00003e5MzGUAU; first error: FIELD_INTEGRITY_EXCEPTION, Assigned To ID: id value of incorrect type: 00G2M000003OvngUAC: [OwnerId]

When I went into the task with the ID listed, I noticed that it was owned by a Queue.  Upon changing the two tasks owned by Queues on the lead to a user, the lead was able to convert.

Apparently, we can't convert a lead that has tasks owned by a queue?

Has anyone else run into this?

Craig
Danish HodaDanish Hoda
Hi Craig,
The reason behind this when you maually create a task and assign it to a Public group/Roles/Roles and Sub-Ordinates/Users using Multiple Users tab on Assign To lookup filed, you will notice different tasks are created as per the number of Users selected and those tasks are assigned to each single user. And thus, If you are trying to create task to those persons using Apex, you will get FIELD_INTEGRITY_EXCEPTION.
Craig WoodmanCraig Woodman
Danish, 

That makes sense now that I think about it.  Another question related - Can I use a before update flow to re-assign the task to the user who is converting the lead?

Craig
Danish HodaDanish Hoda
Hi Craig,
Yes, you can do that.
Craig WoodmanCraig Woodman
Well, you can't, now that I think about it.  The before update flow will not allow updates to anything other than the lead record, and we need to update the tasks.  Also, a regular flow triggered by process builder will not update the records in time.
Danish HodaDanish Hoda
oh, nice thought Craig. (y)
Craig WoodmanCraig Woodman
How I ended up solving this, was that I was using the unassigned queue when a lead could not be assigned to a rep (location information was missing).  In this case, before converting, a Sales rep transferred ownership to themselves. At that point, I triggered a flow with process builder which re-assigns all queue owned tasks to the new owner. Should take care of it.