You need to sign in to do that
Don't have an account?
Javascript - error handling an undefined substring error
I know why it is happening, my array is empty. What I want to be able to do is provide a logica error for the end user, not a browser parped javascript technical error bubble.
Here is the code:
Here is the code:
result1 = sforce.connection.query("SELECT ContractNumber FROM Contract where Id = \'" + idToUse + "\'"); records1 = result1.getArray("records"); for (var i = 0; i < records1.length; i++) { var record1 = records1[i]; contrId1 = record1.ContractNumber.substring(0, 15); }The SoQL will occasionally be empty, so I need to flag some sort of "please make sure Contract Number has been entered" and exit the code. Can anyone help?
is that what you mean?
The below code will work like what you expecting
please re investigate,might be missing something.