Answered by:
how to declare global variables in JS file and how to access functions from External js file in mscrm

Question
-
how to declare global variables in JS file and how to access functions from External js file in mscrm
hariMonday, June 13, 2011 11:27 AM
Answers
-
- Marked as answer by DavidJennawayMVP, Moderator Friday, September 2, 2011 6:21 PM
Monday, June 13, 2011 12:16 PMModerator -
The drawback of Implicit Variables is sometimes you don't really know whether it's a defined variable or an implicit variable, since they look the exactly same. The only difference is, a defined variable usually has its definition somewhere before the assignment is used, while an implicit variable doesn't have such definition up front.
Using implicit variable is a bad practice, since it could unintentionally overwrite a global variable that you don't intend to do so. In order to be expressive, you should always try to be explicit when you actually intend to define or overwrite a global variable.
Hope this makes sense.
Daniel Cai | http://danielcai.blogspot.com- Marked as answer by DavidJennawayMVP, Moderator Friday, September 2, 2011 6:21 PM
Monday, June 13, 2011 10:50 PM
All replies
-
- Proposed as answer by HIMBAPModerator Monday, June 13, 2011 12:04 PM
Monday, June 13, 2011 12:00 PMModerator -
In mscrm 4.0
hariMonday, June 13, 2011 12:12 PM -
- Marked as answer by DavidJennawayMVP, Moderator Friday, September 2, 2011 6:21 PM
Monday, June 13, 2011 12:16 PMModerator -
There are two easy ways to define global variables in JS.
- Implicit variables, such as:
myVariable = myValue;
- Explicit use of window object
window.myVariable = myValue;
Usually implicit variable is considered bad practice. So you should use the 2nd approach in order to be expressive and explicit with your code.
Hope this helps.
Daniel Cai | http://danielcai.blogspot.comMonday, June 13, 2011 3:39 PM - Implicit variables, such as:
-
Is there any drawback on using Implicit Variables?
makeer | myencounterwithcrm.wordpress.comMonday, June 13, 2011 10:43 PM -
The drawback of Implicit Variables is sometimes you don't really know whether it's a defined variable or an implicit variable, since they look the exactly same. The only difference is, a defined variable usually has its definition somewhere before the assignment is used, while an implicit variable doesn't have such definition up front.
Using implicit variable is a bad practice, since it could unintentionally overwrite a global variable that you don't intend to do so. In order to be expressive, you should always try to be explicit when you actually intend to define or overwrite a global variable.
Hope this makes sense.
Daniel Cai | http://danielcai.blogspot.com- Marked as answer by DavidJennawayMVP, Moderator Friday, September 2, 2011 6:21 PM
Monday, June 13, 2011 10:50 PM