On random basis JavaScript customisations doesn't load
Hi,
At the moment, in our environment we have Javascripts, written to customise our change request form.
Due to some unknow reasons, JavaScript customisations randomly don't load, due to which on intermittent basis wrong Change form gets load when we try to edit a change request.
Is there any way we could find out the difference between the loading of the scripts when the issue is happening?
Thanks,
Akshita
Answers
Hi Akshita,
How are being loaded? How do you know they are not loading (vs loading fine but not working)?
Geoff
Hi Geoff,
We have JavaScripts which hides and displays a filed item on the basis of CR type.
So, for a particular type of Change request that field item should be hidden BUT in some cases on random basis that filed items is displaying (when it shouldn't). That's how i know that the scripts are not lading fine.
Thanks.
Akshita
I don't want to interfere with Geoff here, but have you had a look at the browser console when the Javascript doesn't load?
Just for clarification: If your Javascript doesn't load on Closed WorkItems this is intended, as for closed workitems, the custom.js customizations are not loading by default.
No interfering going on here Simon. Thanks for input. Looking in browser console is a great idea.
To clarify, custom.js is loaded and execute on closed work items, but custom tasks are not executed which is why I was asking how they are loaded and trying to explain the potential difference how code not being loaded vs being loaded successfully but not being run or even failing to run.
Really? Because our customizations for hiding/showing certain fields in work items are not loading on Closed work items. No matter which work item type.
Thanks Simon and Geoff.
The issue is not when the worktime is in closed state.
The issue is when we have a change request form ready to submit. A field item appears randomly even it is not intended to appear on that type of change request form.
Since it is an intermittent issue, it is hard to replicate. Do you think is there any way we could find out the difference between the loading of the scripts when the issue is happening?
Hi
I've been taking a look and I think I have some info that could help. I can confirm that this script is loaded through a custom.js file and that checking in the console and adding in console.log("") lines to the javascript customisation confirms that the script is loading and running.
The easiest way I've found to replicate this is to open many tabs of the same change request and click edit on all of those tabs, eventually I get a tab that will show the event field that we're trying to hide via javascript. Through putting console.log() lines all through the script I've concluded the script either then stops or hangs (not sure which) at this command: "app.custom.formTasks.add('ChangeRequest', null, function (formObj, viewModel)".
I did try using a try-catch to see if there was any errors not showing in the console but didn't get any results.