OnChange Event code is not copying in the fields

Hi Experts,

This is a secondary post from an earlier post. I thought it might be less confusing to start a new post for a new problem.

For some reason the attached code is not copying in the fields. I have used similar code on other entities and it has always works. Why doesn’t it work now?

I do not have Visual Studio installed so it makes it hard for me to see if I’ve missed something. I am not getting any errors either with the OnChange Event or with the save.

Thanks for your help. :)
function-ChangeInspectionSite-re.txt
jlblankeAsked:
Who is Participating?
 
Chinmay PatelEnterprise ArchitectCommented:
I took a quick look but not sure if there is something wrong with this code or not. I will spend some time on it tomorrow.

And as long as the script debugging is concerned, you can debug your script using Internet Explorer only. You don't need a fancy IDE :). In Internet Explorer press F12 and then.... well... see it for yourself.

Let me put icing on the cake... check this link for more information on Dev Tools : http://msdn.microsoft.com/en-us/library/ie/gg589507(v=vs.85).aspx

Also you could use Free tools I suggested in one of the post earlier. They are free and will allow you to debug the script.
0
 
Chinmay PatelEnterprise ArchitectCommented:
Hi jblanke,

Check line 280

catch (e) { };

Open in new window


if there is an error this statement will hide it. This is bad programming practice. replace it with

catch (e) { alert(e.message)};

Open in new window


and run the code. Let me know if you get any error message this time.

Regards,
Chinmay.
0
 
jlblankeAuthor Commented:
I made the change. I am getting a 'retrieveParentCustomer' error on change.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Chinmay PatelEnterprise ArchitectCommented:
Hi jblanke,

I will need more than that to figure out what is wrong. Kindly share the exact error message please.

Regards,
Chinmay.
0
 
jlblankeAuthor Commented:
Here is the error. It is what I was getting on the previous post. I have attached the code.

There was an error with this field's customized event.

Field:customerid
Event: onchange
Error: Object doesn't support property or method 'retrieveCustomer'.
function-ChangeInspectionSite-re.txt
0
 
jlblankeAuthor Commented:
I modified the script (attached). If I  open an existing record and change the field I no longer get any errors. The script removes the old data from the fields; BUT, the new data IS NOT populating in the fields.

If I open a new record and change the field I get the following error:

     There was an eror with this field's customized event.
     Field: customerid
     Event: onchange
     Error: Object doesn't support property or method 'retrieveCustomer'.

Please help. My boss wants this working today and I am unsure of how to proceed because I cannot see where my error is.
modified-function-ChangeInspecti.txt
0
 
Chinmay PatelEnterprise ArchitectCommented:
Hi jblanke,

Sorry I will not be able to look into this matter till Saturday. I suggest you use a javascript debugger or at least start using any one of the IDEs I suggested earlier.

Regards,
Chinmay.
0
 
jlblankeAuthor Commented:
Thanks Chinmay. I'll check into those. I'll look forward to hearing from you this weekend. :)
0
 
Chinmay PatelEnterprise ArchitectCommented:
In the mean time, try to learn how to debug JavaScript.
0
 
jlblankeAuthor Commented:
Unfortunately I do not have any software tools to help with the debugging. If I get an error which points to a specific line then I manually count the lines of code until I get to the error. You have been very helpful in showing me what to look for when I have been getting some of the errors.

This is a most puzzling problem.

I made some corrections to the script. I am now not getting any errors when I change the field, but I also am not getting the data to update the fields. I will continue to plug away. My manager has given me a brief reprieve, but I know he is looking for results.

I will continue to plug away. . . . :)
0
 
jlblankeAuthor Commented:
Well, here's an update. I got the code to populate the fields, but when I do a save, the data in the fields go away.

Any thoughts? I have attached my revised code.
revised-code.txt
0
 
jlblankeAuthor Commented:
Cool!  I did the Internet Explorer F12 debugger. It did not show any breakpoints. I am really stymied on this because the code works on other forms.
0
 
jlblankeAuthor Commented:
Not sure what exactly happened. But the code is working now. When I change the field value the subsequent fields are updated. When I save the form (or do a save and close) the new data remains in the fields.

Is is possible that there is a delay between the updates I make and the server refresh?

Thanks for being so patient with me.
0
 
jlblankeAuthor Commented:
Thank you for your patience in working with me through this unusual problem. The 'icing' you provided was invaluable and has given me a tool to use on all of my coding problems. It is worth the excellent rating and score.

:)
0
 
Chinmay PatelEnterprise ArchitectCommented:
Hi jblanke,

First of all super thanks for nice words :).

Actually I don't have patience :P so I try to make people independent.. :D and I think in this case it worked out perfectly.

Now to the questions:
- Let me know if you need help with debugging via Dev Tools.
- Yes. It is very important to understand concept of local caching in Browsers. Browsers, by design cache most of the stuff you see on websites(notice most of ) so it is a good chance that Scripts are cached as well so it is a good practice to always clean your browser cache when you are developing Scripts.
 - Also with CRM always remember to Save and Publish your changes :) It can be a culprit sometimes.

Regards,
Chinmay.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.