function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priyadarshini Manoharan 3Priyadarshini Manoharan 3 

Not sure why and where I am getting this error Validation Errors While Saving Record(s). The first validation error encountered was "Owner ID: id value of incorrect type:

The issue was introduced as when we had queue being assigned in Lead Assignment Rule. We have custom code on Lead Convert button which tries to create a new Contact with the Lead Owner Id, it is unable to create a new contact with Lead Owner Id as the Lead Owner is a queue. I want to display custom error message and overcome this error. However the error gets fired still.
GulshanRajGulshanRaj
Hi Priyadarshinin,

You can do several things to achieve your objective:
1) Add validation rule on lead which restrict lead to convert. This way you can display custom message.
AND(IsConverted,  (LEFT(OwnerId,3)<>'005'))

2) For code:  before convertion of lead check if owner is still not queueID. If it is queue assign it with current user using UserInfo.getUserId().

Please let me know if you still struggling.

Thanks
Gulshan Raj