web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Error on qualifying a Lead - Cannot read property 'setValue' of null

(0) ShareShare
ReportReport
Posted on by 5

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!

I have the same question (0)
  • Suggested answer
    Timothy Bohte Profile Picture
    44 on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    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 

  • Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    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.

    carldesouza.com/.../

    Please verify this answer if you will able to resolve this issue.

    Thank you,

    Amit Katariya

  • Harbour Profile Picture
    5 on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    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?

  • Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    Hi,

    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

  • necsa Profile Picture
    3,455 on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    Hi,

    I think the field is not on the Form.

  • Esteban Coto Alfaro Profile Picture
    on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    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.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Error on qualifying a Lead - Cannot read property 'setValue' of null

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 141

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 132

#3
DAnny3211 Profile Picture

DAnny3211 130

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans