by Gustaf Westerlund | Feb 23, 2009
Today I had a very weird error. I had two datetime fields on a form, one on the first tab and one one the second. Let’s call them date1 and date2 to make it easier.
I attached an event in the onload by using
crmForm.all.date1.attachEvent(“onchange”, myFunc1);
and for the date2 field:
crmForm.all.date2.attachEvent(“onchange”, myFunc2);
The weird part was that if I changed date1 first and then date2, myFunc2 didn’t fire. But if I first changed date2 and then date1, both fired as they should.
So I tried just adding an alert instead using the normal onchange method via the form editor in CRM and that triggered every time, just as it should, so something is different.
The simple solution seemed to be to move date2 from the second tab to the first. That got everything working just as it should.
I havn’t tried it but I think that one could also write a method that confirms all the event attachments and then calling this at the end of every onchange triggering function and perhaps some extra time when the tabs are changed to make sure the events are bound correctly.
I have checked the documentation in CRM for if this kind of runtime event attachment might not be supported but my interpretation of the text is that is should be all right according to it. The closest paragraph in the unsupported customization section is the following:
“The use of custom HttpModules to inject HTML/DHTML into the Microsoft Dynamics CRM Forms. “
As I wrote, my interpretation is that attaching events (not even overwriting the onchange), should be ok according to this since we arn’t injecting anything, just adding an event listener. Hence I feel that this must be interpreted as a bugg in CRM.
Gustaf Westerlund
Microsoft Dynamics CRM Architect
Logica
www.logica.com
by Gustaf Westerlund | Feb 17, 2009
When writing javascripts with alerts or similar when not working with english, special characters like the swedish åäö might not be shown correctly. I found this helpful page where you can enter the string you want to convert and then copy paste the result. Simple and nice.
http://rishida.net/scripts/uniview/conversion.php
Gustaf Westerlund
Microsoft Dynamics CRM Architect
Logica
www.logica.com
by Gustaf Westerlund | Feb 17, 2009
I’ve been having some problems with my blogs in Outlook but today I fixed it and started checked if there was anything special and found this very interesting article on Ronald Lemmens blog.
http://ronaldlemmen.blogspot.com/2009/02/using-advanced-find-for-fetchxml.html
He describes how to, without any code or customizations to a system, easily get the fetchxml code from an advanced find by just putting some javascriptcode in the url of the window. Beautiful in all it simplicity!
Gustaf Westerlund
Microsoft Dynamics CRM Architect
Logica
www.logica.com
by Gustaf Westerlund | Feb 17, 2009
The project I am currently involved in uses Reporting Services reports that are shown as PDF:s as quotes that are sent to the customer. It is implemented by creating a custom report that takes the object id (like quote) which is called from an isv.config button and by using querystring parameters, the output is directed to PDF.
However, I got a puzzeling bug. The data in the quote is of course based on data in some CRM entities and when a quote was generated and the user found something was wrong, changed this in CRM, saved and then tried to regenerate the PDF, the change didn’t show. I restared Internet Explorer, and regenerated the quote-pdf and now it showed correctly. Hence some sort of caching error.
I looked around the internet a bit and found that by adding the following parameter to the querystring, I could refresh the sessions variables and I would get a fresh and correct report.´
&rs:ClearSession=true
So, the entire url was (except for the report id etc.):
&rs:Command=Render&rs:ClearSession=true&objid={D1F1FD5D-D7F8-DD11-967B-005056AA29F5}&rs:Format=PDF
So, if you get a similar error, just try setting this.
It is also possible that IE caches the pdf and then you’ll have to add some variable to the querystring, like a tick or datetime that is unique for every call (from that client) and that will bypass IE:s caching.
Gustaf Westerlund
Microsoft Dynamics CRM Architect
Logica
www.logica.com
by Gustaf Westerlund | Feb 3, 2009
Today I was troubleshooting a CRM server which had the CRMAsycnService and w3wp service totally hogging the machine. It was quite obvious that it was CRM that was the cause for this and since CRMAsyncService was involved, probably workflows or perhaps the deletionservice.
After a bit of looking around I found a workflow that was set to trigger on attribute change on an entity and then later in that same entity, changed some attributes. This caused an infinite loop which was the cause for the hogging. By first unpublishing the workflow and then removing all started systemjobs, I got the machine back up to speed.
My conclusion from this is that even though the workflow GUI seems easy it is deceitfully powerfull and you quite easily create workflows that hogg the server (the server hosting the async-service anyway). This should be taken into consideration when putting this tool into the hands of non-programmers since the risk for the entire system stability is large. This can be either application consultants or power users at the customer.
There is also no standard way of locking some of the triggers on workflows so that you can eliminate this risk. I you know of any, please leave a comment!
Gustaf Westerlund
Microsoft Dynamics CRM Architect
Logica
www.logica.com
Recent Comments