On qualifying a lead to a case, information is copied to the Contact and the Case. But every time I qualify, I get this error: Cannot read property 'setValue' of null. It's strange as the case is created and the updates are there, however, I suspect that one of the fields is not actually being set or updated. How can I find out what field this is? The error log is as follows:
TypeError: Cannot read property 'setValue' of null at Object.success (crm.harboursport.co.nz/.../hs_ReferralJSLibrary at o (crm.harboursport.co.nz/.../hs_jQueryLib at Object.fireWith [as resolveWith] (crm.harboursport.co.nz/.../hs_jQueryLib at w (crm.harboursport.co.nz/.../hs_jQueryLib at d (crm.harboursport.co.nz/.../hs_jQueryLib at Object.send (crm.harboursport.co.nz/.../hs_jQueryLib at Function.ajax (crm.harboursport.co.nz/.../hs_jQueryLib at ShowSelectedContactDetails (crm.harboursport.co.nz/.../hs_ReferralJSLibrary at eval (eval at RunHandlerInternal (crm.harboursport.co.nz/.../ClientApiWrapper.aspx, <anonymous>:1:1) at RunHandlerInternal (https://crm.harboursport.co.nz/form/ClientApiWrapper.aspx?ver=-904332278:157:1)
Thank you!
Hi,
When qualifying a lead, the system will try to create three records, an opportunity, account and contact. Check if there are any mandatory collums in those tables that are not present or mandatory on the lead form.
Regards,
Timothy
Yup you can easily check by debugging your code.
Please refer below link where you will find the steps to debug JavaScript code.
carldesouza.com/.../
Also one suggestion please always check if your source field is null or not. if it is not null then set the value to destination field.
Please verify this answer if you will able to resolve this issue.
Thank you,
Amit Katariya
Thank you for your explanations and yes that makes total sense. I am however trying to figure out what field it is on the destination that is missing on the lead form... how can I check this?
Below is the possible reasons :-
1. The Field which you are referring on the Lead form is not present on the lead form itself. That means in source it self will have value as null and when you trying to set that value on designated fields then you will get the Null error.
2. The field which you are trying to set on the form is not present on the form.
3. It is possible that you have provided wrong "Schema name" of that field which you are trying to Get or Set.
stackoverflow.com/.../weird-error-typeerror-cannot-read-property-setvalue-of-null-at-onsuccessmapun
I think the field is not on the Form.
Hello, I recommend to add a debugger inside the function so you can figure out which field is throwing the error.
Thanks!
Community Support Team - Esteban
If this Post helps, then please consider Accept as solution to help the other members find it more quickly.
Hello,
According to the error description, you have an issue with your code. You will have to troubleshoot it. Check my video on how you can do it:
www.youtube.com/watch
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Mansi Soni as our August 2025 Community…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Hamza H 141
Daniyal Khaleel 132
DAnny3211 130