//create request to retrieve Webresource QueryByAttribute requestWebResource = new QueryByAttribute { EntityName = WebResource.EntityLogicalName, ColumnSet = new ColumnSet(true), }; requestWebResource.Attributes.AddRange("name"); requestWebResource.Values.AddRange("url/XML/TestData.xml"); WebResource webResource = null; EntityCollection webResourceCollection = organizationService.RetrieveMultiple(requestWebResource); if (webResourceCollection.Entities.Count == 0) throw new InvalidPluginExecutionException("Specified Webresource does not exist"); webResource = (WebResource)webResourceCollection.Entities[0]; byte[] binary = Convert.FromBase64String(webResource.Attributes["content"].ToString()); string resourceContent = UnicodeEncoding.UTF8.GetString(binary);
CRM 2011 CS: create request to retrieve Webresource
CRM 2011 CS: Query to get All Records
// Query to get All Records protected EntityCollection getROBs(string EntityName) { CreatOrgSvcProx cosp = new CreatOrgSvcProx(); OrganizationServiceProxy prox = cosp.getServiceProxy(); ColumnSet _all = new ColumnSet(true); QueryExpression _robQuery = new QueryExpression(EntityName); _robQuery.ColumnSet = _all; EntityCollection _allRec = prox.RetrieveMultiple(_robQuery); return _allRec; } //
C#: DATE-TIME FUNCTIONS
// DATE FUNCTIONS
// Get Current Year
protected int _currentYear()
{
DateTime dtn = DateTime.Now;
int ret= dtn.Year;
return ret;
}//**
// Get Current Month
protected int _currentMonth()
{
DateTime dtn = DateTime.Now;
int ret = dtn.Month;
return ret;
}//**
// Get current month in string
protected string _curMonthStr()
{
string thismonth = String.Format("{0:MMMM}", DateTime.Now).ToString();
return thismonth;
}
// Get Current Day
protected int _currentDay()
{
DateTime dtn = DateTime.Now;
int ret = dtn.Day;
return ret;
}//**
// Get Sundays for this month
protected int[] getSundays(int year, int month, DayOfWeek dayName)
{
int[] _sunday = new int[4];
CultureInfo ci = new CultureInfo("en-US");
int ai = 0;
for (int i = 1; i <= ci.Calendar.GetDaysInMonth(year, month); i++)
{
if (new DateTime(year, month, i).DayOfWeek == dayName)
{
//Response.Write(i.ToString());
_sunday[ai] = i; ai += 1;
}
}
return _sunday;
}//**
CRM 4: Create CRM Organization
public class CreateCrmOrg
{
public CreateCRM_Org()
{
static void Main()
{
DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
.ProxyClientHelper.CreateClient(new Uri("http://srv-crm04/XRMDeployment/2011/Deployment.svc"));
Console.WriteLine(CreateOrganization(service
,new Organization
{
UniqueName = "testOrgProv1",
FriendlyName = "testOrgProv1",
SqlServerName = "SQL1-CRM04",
SrsUrl = "http://SQL1-CRM04/ReportServer",
BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
}));
}
Guid? CreateOrganization(IDeploymentService deploymentService,Organization org)
{
BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest
{
Organization = org
};
BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse;
return resp != null ? (Guid?)resp.OperationId : null;
}
}
C#: Get num of days in month
DateTime.DaysInMonth(int year, int month);
//or
static int GetDaysInMonth(int year, int month)
{
DateTime dt1 = new DateTime(year, month, 1);
DateTime dt2 = dt1.AddMonths(1);
TimeSpan ts = dt2 - dt1;
return (int)ts.TotalDays;
}
C#: Get sundays in month
using System.Globalization;
protected void PrintSundays(int year, int month, DayOfWeek dayName)
{
CultureInfo ci = new CultureInfo("en-US");
for (int i = 1 ; i <= ci.Calendar.GetDaysInMonth (year, month); i++)
{
if (new DateTime (year, month, i).DayOfWeek == dayName)
Response.Write (i.ToString() + "<br/>");
}
}
C#: HttpWebRequest example with error handling using C#
using System;
using System.IO;
using System.Net;
using System.Text;
public class HttpWebRequestTool
{
public static void Main(String[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Missing argument. Need a URL and a filename");
}
else
{
StreamWriter sWriter = new StreamWriter(args[1]);
sWriter.Write(WRequest(args[0], "GET", ""));
sWriter.Close();
}
}
public static string WRequest(string URL, string method, string postData)
{
string responseData = "";
try
{
System.Net.HttpWebRequest hwrequest =
(System.Net.HttpWebRequest) System.Net.WebRequest.Create(URL);
hwrequest.Accept = "*/*";
hwrequest.AllowAutoRedirect = true;
hwrequest.UserAgent = "http_requester/0.1";
hwrequest.Timeout= 60000;
hwrequest.Method = method;
if (hwrequest.Method == "POST")
{
hwrequest.ContentType = "application/x-www-form-urlencoded";
// Use UTF8Encoding instead of ASCIIEncoding for XML requests:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] postByteArray = encoding.GetBytes(postData);
hwrequest.ContentLength = postByteArray.Length;
System.IO.Stream postStream = hwrequest.GetRequestStream();
postStream.Write(postByteArray, 0, postByteArray.Length);
postStream.Close();
}
System.Net.HttpWebResponse hwresponse =
(System.Net.HttpWebResponse) hwrequest.GetResponse();
if (hwresponse.StatusCode == System.Net.HttpStatusCode.OK)
{
System.IO.Stream responseStream = hwresponse.GetResponseStream();
System.IO.StreamReader myStreamReader =
new System.IO.StreamReader(responseStream);
responseData = myStreamReader.ReadToEnd();
}
hwresponse.Close();
}
catch (Exception e)
{
responseData = "An error occurred: " + e.Message;
}
return responseData;
}
}
CRM 2011 JS: Reading XML file in CRM 2011
//Code Snippet
var nodePath = "//attributes/attribute";
var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.preserveWhiteSpace = true;
doc.async = false;
doc.load(xmlPath);
params = new Array();
var nodelist;
nodelist = doc.selectNodes(nodePath);
for (var i = 0; i < nodelist.length; i++)
{
params[i] = nodelist(i).attributes[0].value;
}
CRM 2011 JS: Execute a Dialog using Jscript
//Code snippet
var dialogId = "a13ad982-d812-40a0-ab67-f314cdabbd2b"; // This must be your Dialog ID
var returnValue = showModalDialog("/" + Xrm.Page.context.getOrgUniqueName() +
"/cs/dialog/rundialog.aspx?DialogId=%7b" + dialogId +
"%7d&EntityName=account&ObjectId=" + Xrm.Page.data.entity.getId());
CRM 2011 JS: Clear Lookup using Jscript
//Code Snippet:
function SetLookupNull(lookupAttribute){
var lookupObject = Xrm.Page.getAttribute(lookupAttribute);
if (lookupObject != null)
{
Xrm.Page.getAttribute(lookupAttribute).setValue(null);
}
}
CRM 2011 CS: Sharing Records in CRM 2011
// Create the request object and set the target and principal access
GrantAccessRequest grantRequest = new GrantAccessRequest()
{
Target = new EntityReference(Account.EntityLogicalName, accountId),
PrincipalAccess = new PrincipalAccess()
{
Principal = new EntityReference(SystemUser.EntityLogicalName, userId),
AccessMask = actionRights
}
};
// Execute the request.
GrantAccessResponse granted = (GrantAccessResponse)service.Execute(grantRequest);
CRM 2011 CS: SharedVariables in CRM 2011 plugins
// Passing Data to shared Variable
context.SharedVariables.Add("PrimaryContact", (Object)contact.ToString());
// Retrieving data from context shared variables.
Guid contact = new Guid((string)context.SharedVariables["PrimaryContact"]);
CRM 2011 JS: Custom Lookup Filter Lookup in CRM 2011
function customfilterlookup(AccoundID)
{
//Show Contacts which has selected parent Account
//build fetchxml, use Advance Find to get Fetchxml
var viewId = "{a76b2c46-c28e-4e5e-9ddf-951b71202c9d}"; //view Guid
var entityName = "contact"; // Entity to be filtered
var viewDisplayName = "Active Contacts"; // Custom name for the lookup window.
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
"<entity name='contact'>" +
"<attribute name='fullname' />" +
"<attribute name='parentcustomerid' />" +
"<attribute name='emailaddress1' />" +
"<attribute name='address1_telephone2' />" +
"<attribute name='new_city' />" +
"<attribute name='address1_stateorprovince' />" +
"<attribute name='address1_telephone1' />" +
"<attribute name='ownerid' />" +
"<attribute name='contactid' />" +
"<order attribute='fullname' descending='false' />" +
"<filter type='and'>" +
"<condition attribute='parentcustomerid' operator='eq' uitype='account' value='"+AccoundID+"' />" +
"<condition attribute='statecode' operator='eq' value='0' />" +
"</filter>" +
"</entity>" +
"</fetch>";
// Build Grid Layout. building a custom view for the Lookup
//building grid layout with the columns which needs to be displayed in the lookup view
var layoutXml = "<grid name='resultset' " +
"object='1' " +
"jump='name' " +
"select='1' " +
"icon='1' " +
"preview='1'>" +
"<row name='result' " +
"id='contactid'>" + // Id/key attribute of the entity to be filtered
"<cell name='fullname' " +
"width='250' />" +
"<cell name='new_city' " +
"width='70' />" +
"<cell name='address1_telephone1' " +
"width='100' />" +
"</row>" +
"</grid>";
// add new view to the lookup
Xrm.Page.getControl("contact").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
}
CRM 2011 CS: get two options field Text
// Get Normal two option set Text
string twoOptionLable = entity.FormattedValues["new_twoOptionSet"];
CRM 2011 CS: Retrieve Normal(Local) Option Set Text
// Get Normal option set Text
string optionsetText = entity.FormattedValues["new_optionset"];
or
string optionsetText = entity.GetFormattedAttributeValue("new_optionset");
C#: Using inline code in ASP.NET
Using this syntax, you can use inline code in ASP.NET (.aspx) pages. The server-side code will be automatically compiled by the .NET framework the first time the page is requested on the server. The compiled .dll file is stored in the "Temporary ASP.NET Files" system folder. Changing the code in .aspx files will trigger a new compilation, generating new .dll files. The old .dll files are phased out by the framework and eventually deleted.
<%@ Import Namespace="System" %>
<%@ Page Language="c#"%>
<script runat="server">
public string ServerSideFunction(string input)
{
return "Hello " + input;
}
</script>
<% string pageVariable = "world"; %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>ASP.NET inline</title>
</head>
<body>
<% =ServerSideFunction(pageVariable) %>
</body>
</html>
JS: Winpopup for Internet Explorer
var oPopup = window.createPopup();
function ButtonClick()
{
var oPopBody = oPopup.document.body;
oPopBody.style.backgroundColor = "lightyellow";
oPopBody.style.border = "solid black 1px";
oPopBody.innerHTML = "Click outside <B>popup</B> to close.";
oPopup.show(100, 100, 180, 25, document.body);
}
CRM 2011 JS: Xrm intellisense for Visual Studio
// CRM 2011 Xrm intellisense
// use Xml Reference to use
var XrmTypes = {
Section: function () {
},
SectionCollection: function () {
},
Tab: function () {
},
TabCollection: function () {
},
Control: function () {
},
ControlCollection: function () {
},
NavigationItem: function () {
},
NavigationItemsCollection: function () {
},
Navigation: function () {
this.items = new XrmTypes.NavigationItemsCollection();
},
FormSelectorItem: function () {
},
FormSelectorItemsCollection: function () {
},
FormSelector: function () {
this.items = new XrmTypes.FormSelectorItemsCollection();
this.getCurrentItem = function () {
///<summary>Returns a reference to the form currently being shown.</summary>
///<returns type="XrmTypes.FormSelectorItem"/>
}
},
Ui: function () {
this.tabs = new XrmTypes.TabCollection();
this.controls = new XrmTypes.ControlCollection();
this.navigation = new XrmTypes.Navigation();
this.formSelector = new XrmTypes.FormSelector();
},
Option: function () {
},
Lookup: function () {
},
Attribute: function () {
},
AttributeCollection: function () {
},
Entity: function () {
this.attributes = new XrmTypes.AttributeCollection();
},
Data: function () {
this.entity = new XrmTypes.Entity();
},
Context: function () {
},
Page: function () {
this.context = new XrmTypes.Context();
this.ui = new XrmTypes.Ui();
this.data = new XrmTypes.Data();
},
Xrm: function () {
this.Page = new XrmTypes.Page()
},
__namespace: true
};
XrmTypes.Xrm.__class = true;
XrmTypes.Page.__class = true;
XrmTypes.Ui.__class = true;
XrmTypes.Context.__class = true;
XrmTypes.Data.__class = true;
XrmTypes.Entity.__class = true;
XrmTypes.AttributeCollection.__class = true;
XrmTypes.Attribute.__class = true;
XrmTypes.SectionCollection.__class = true;
XrmTypes.Section.__class = true;
XrmTypes.ControlCollection.__class = true;
XrmTypes.Control.__class = true;
XrmTypes.TabCollection.__class = true;
XrmTypes.Tab.__class = true;
XrmTypes.Navigation.__class = true;
XrmTypes.NavigationItemsCollection.__class = true;
XrmTypes.NavigationItem.__class = true;
XrmTypes.FormSelector.__class = true;
XrmTypes.FormSelectorItemsCollection.__class = true;
XrmTypes.FormSelectorItem.__class = true;
XrmTypes.Option.__class = true;
XrmTypes.Lookup.__class = true;
XrmTypes.Page.prototype = {
getAttribute: function (id) {
///<param name="id">String: The attribute where the name matches the argument. function(attribute, index): Any attributes that cause the delegate function to return true</param>
///<summary>Shortcut for Xrm.Page.data.entity.attributes.get</summary>
///<returns type="XrmTypes.Attribute"></returns>
return new XrmTypes.Attribute();
},
getControl: function (id) {
///<summary>Returns one or more controls depending on the arguments passed.</summary>
///<param name="id">String: The control where the name matches the argument. function(attribute, index): Any controls that cause the delegate function to return true</param>
///<returns type="XrmTypes.Control"></returns>
return new XrmTypes.Control();
}
};
XrmTypes.Ui.prototype = {
getFormType: function() {
///<summary>Indicates the form context for the record.</summary>
///<returns type="Number"/>
},
getCurrentControl : function() {
///<summary>Returns the control object that currently has focus on the form.</summary>
///<returns type="XrmTypes.Control"/>
},
getViewPortHeight : function() {
///<summary>Returns the height of the viewport in pixels.</summary>
///<returns type="Number"/>
},
getViewPortWidth : function() {
///<summary>Returns the width of the viewport in pixels.</summary>
///<returns type="Number"/>
},
refreshRibbon : function() {
///<summary>Causes the Ribbon to re-evaluate data that controls how it is displayed.</summary>
},
close : function() {
///<summary>Closes the form.</summary>
}
};
XrmTypes.FormSelectorItemsCollection.prototype = {
get: function (id) {
///<returns type="XrmTypes.FormSelectorItem"></returns>
return new XrmTypes.NavigationItem();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function () {
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
};
XrmTypes.NavigationItemsCollection.prototype = {
get: function (id) {
///<returns type="XrmTypes.NavigationItem"></returns>
return new XrmTypes.NavigationItem();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function () {
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
};
XrmTypes.AttributeCollection.prototype = {
get: function (id) {
///<param name="id">String: The attribute where the name matches the argument. function(attribute, index): Any attributes that cause the delegate function to return true</param>
///<returns type="XrmTypes.Attribute"></returns>
return new XrmTypes.Attribute();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function(){
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
};
XrmTypes.TabCollection.prototype = {
get: function (id) {
///<summary>Returns one or more tabs depending on the arguments passed.</summary>
///<returns type="XrmTypes.Tab"></returns>
return new XrmTypes.Tab();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function () {
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
}
XrmTypes.SectionCollection.prototype = {
get: function (id) {
///<summary>Returns one or more sections depending on the arguments passed.</summary>
///<returns type="XrmTypes.Section"></returns>
return new XrmTypes.Section();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function () {
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
}
XrmTypes.ControlCollection.prototype = {
get: function (id) {
///<summary>Returns one or more controls depending on the arguments passed.</summary>
///<param name="id">String: The control where the name matches the argument. function(attribute, index): Any controls that cause the delegate function to return true</param>
///<returns type="XrmTypes.Control"></returns>
return new XrmTypes.Control();
},
forEach: function (delegate) {
///<summary>Applies the action contained within a delegate function.</summary>
///<param name="delegate" type="Delegate">Applies the action contained within a delegate function.</param>
},
getLength: function () {
///<summary>Returns the number of items in the collection.</summary>
///<returns type="Number"/>
}
};
XrmTypes.FormSelectorItem.prototype = {
getId: function () {
///<summary>Returns the GUID ID of the roleForm</summary>
///<returns type="String"/>
},
getLabel: function () {
///<summary>Returns the label of the roleForm.</summary>
///<returns type="String"/>
},
navigate: function() {
///<summary>Opens the specified roleForm</summary>
}
};
XrmTypes.NavigationItem.prototype = {
getId: function () {
///<summary>Returns the name of the item.</summary>
///<returns type="String"/>
},
getLabel: function () {
///<summary>Returns the label for the tag.</summary>
///<returns type="String"/>
},
getVisible: function () {
///<summary>Returns a value that indicates whether the item is visible.</summary>
///<returns type="Boolean"/>
},
setFocus: function()
{
///<summary>Sets the focus on the item.</summary>
},
setLabel: function (value) {
///<summary>Sets the label for the item.</summary>
///<param name="value" type="String">Label</param>
},
setVisible: function (value) {
///<summary>Sets a value that indicates whether the item is visible.</summary>
///<param name="value" type="Boolean"/>
}
};
XrmTypes.Tab.prototype = {
sections: new XrmTypes.SectionCollection(),
getDisplayState: function () {
///<summary>Returns a value that indicates whether the tab is collapsed or expanded. One of the values 'expanded', 'collapsed'.</summary>
///<returns type="String"/>
},
getLabel: function () {
///<summary>Returns the label for the tab.</summary>
///<returns type="String"/>
},
getName: function () {
///<summary>Returns the name of the tab.</summary>
///<returns type="String"/>
},
getParent: function () {
///<summary>Returns the tab containing the tab.</summary>
///<returns type="XrmTypes.Ui"/>
},
getVisible: function () {
///<summary>Returns a value that indicates whether the tab is visible.</summary>
///<returns type="Boolean"/>
},
setDisplayState: function (value) {
///<summary>Sets the tab to be collapsed or expanded.</summary>
///<param name="value" type="String">One of the values 'expanded', 'collapsed'.</param>
},
setFocus: function()
{
///<summary>Sets the focus on the tab.</summary>
},
setLabel: function (value) {
///<summary>Sets the label for the tag.</summary>
///<param name="value" type="String">Label</param>
},
setVisible: function (value) {
///<summary>Sets a value that indicates whether the tag is visible.</summary>
///<param name="value" type="Boolean"/>
}
};
XrmTypes.Section.prototype = {
getLabel: function () {
///<summary>Returns the label for the section.</summary>
///<returns type="String"/>
},
getParent: function () {
///<summary>Returns the tab containing the section.</summary>
///<returns type="XrmTypes.Tab"/>
},
getName: function () {
///<summary>Returns the name of the section.</summary>
///<returns type="String"/>
},
getVisible: function () {
///<summary>Returns a value that indicates whether the section is visible.</summary>
///<returns type="Boolean"/>
},
setLabel: function (value) {
///<summary>Sets the label for the section.</summary>
///<param name="value" type="String">Label</param>
},
setVisible: function (value) {
///<summary>Sets a value that indicates whether the section is visible.</summary>
///<param name="value" type="Boolean"/>
}
};
XrmTypes.Entity.prototype = {
addOnSave: function(delegate) {
///<summary>Sets a function to be called when the record is saved.</summary>
///<param name="delegate" type="Delegate>function pointer</param>
},
removeOnSave: function(delegate) {
///<summary>Removes a function from the OnSave event hander.</summary>
///<param name="delegate" type="Delegate>function pointer</param>
},
getId: function () {
///<summary>Returns a string representing the GUID id value for the record</summary>
///<returns type="String"/>
},
getIsDirty: function () {
///<summary>Returns a Boolean value that indicates if any fields in the form have been modified.</summary>
///<returns type="Boolean"/>
},
getEntityName: function () {
///<summary>Returns a string representing the logical name of the entity for the record.</summary>
///<returns type="String"/>
},
getDataXml: function () {
///<summary>Returns a string representing the xml that will be sent to the server when the record is saved.</summary>
///<returns type="String"/>
},
save: function (type) {
///<summary>Saves the record. </summary>
///<param name="type" type="String" optional="true">(Optional) No value save the records. "SaveAndClose" save then close the record. "SaveAndNew" save then open a new Create form.</param>
}
}
XrmTypes.Control.prototype = {
addCustomView: function(viewId, entityName, viewDisplayName, fetchXml, layoutXml, isDefault) {
///<summary>Adds a new view for the lookup dialog.</summary>
///<param name="viewId" type="String">String: The string representation of a GUID Id for a view. This value is never saved and only needs to be unique amongst the other available views for the lookup. A string for a non-valid GUID will work, for example “{00000000-0000-0000-0000-000000000001}”.</param>
///<param name="entityName" type="String">The name of the entity.</param>
///<param name="viewDisplayName" type="String">The name of the view.</param>
///<param name="fetchXml" type="String">The fetchXml query for the view.</param>
///<param name="layoutXml" type="String">The XML defining the layout of the view.</param>
///<param name="isDefault" type="Boolean">Whether the view should be the default view.</param>
},
addOption: function(option, index) {
///<summary>Adds an option to an Option set control.</summary>
///<param name="option" type="XrmTypes.Option">An option object to add to the OptionSet.</param>
///<param name="index" type="Number"> (Optional) The index position to place the new option. If not provided the option will be added to the end.</param>
},
clearOptions: function() {
///<summary>Clears all options from an Option Set control.</summary>
},
getAttribute: function() {
///<summary>Returns the attribute that the control is bound to.</summary>
///<returns type="XrmTypes.Attribute"/>
},
getControlType: function() {
///<summary>Returns a value that categorizes controls. Return Value Description. Values 0: Standard, 1: Hidden, 2: IFrame, 3: Lookup, 4: Option Set, 5: SubGrid, 6: Web Resource</summary>
///<returns type="Number"/>
},
getDefaultView: function() {
///<summary>Returns the Id value of the default lookup dialog view.</summary>
///<returns type="String"/>
},
getDisabled: function() {
///<summary>Returns whether the control is disabled. This method is not available for Web Resource controls.</summary>
///<return type="Boolean"/>
},
getLabel: function () {
///<summary>Returns the label for the control.</summary>
///<returns type="String"/>
},
getName: function() {
///<summary>Returns the name assigned to the control.</summary>
///<returns type="String"/>
},
getParent: function() {
///<summary>Returns a reference to the section object that contains the control.</summary>
///<returns type="XrmTypes.Section"/>
},
getSrc: function() {
///<summary>Returns the current URL being displayed in an IFrame or Web Resource.</summary>
///<returns type="String"/>
},
getInitialUrl: function() {
///<summary>Returns the default URL that an IFrame control is configured to display. This method is not available for Web Resources.</summary>
///<returns type="String"/>
},
getObject: function() {
///<summary>Returns the object in the form representing an IFrame or Web resource.</summary>
///<returns type="Object"/>
},
getVisible: function() {
///<summary>Returns a value that indicates whether the control is currently visible.</summary>
///<returns type="Boolean"/>
},
refresh: function()
{
///<summary>Refreshes the data displayed in a Sub-Grid.</summary>
},
removeOption: function(value) {
///<summary>Removes an option from an Option Set control.</summary>
///<param name="value" type="Number">The value of the option you want to remove.</param>
},
setDefaultView: function(viewGuid) {
///<summary>Sets the default view for the lookup control dialog.</summary>
///<param name="viewGuid" type="String"></param>
},
setDisabled: function(value) {
///<summary>Sets whether the control is disabled.</summary>
///<param name="value" type="Boolean"></param>
},
setFocus: function() {
///<summary>Sets the focus on the control</summary>
},
setLabel: function(label) {
///<summary>Sets the label for the control.</summary>
///<param name="label" type="String"></param>
},
setSrc: function(src) {
///<summary>Sets the URL to be displayed in an IFrame or Web Resource.</summary>
///<param name="src" type="String"></param>
},
setVisible: function(value) {
///<summary>Sets a value that indicates whether the control is visible.</summary>
///<param name="value" type="Boolean"></param>
}
};
XrmTypes.Attribute.prototype = {
addOnChange: function(delegate) {
///<summary>Sets a function to be called when the attribute value is changed.</summary>
///<param name="delegate" type="Delegate"></param>
},
fireOnChange: function() {
///<summary>Causes the OnChange event to occur on the attribute so that any script associated to that event can execute. </summary>
},
getAttributeType: function () {
///<summary>Returns a string value that represents the type of attribute.</summary>
///<returns type="Object"/>
},
getInitialValue: function () {
///<summary>Returns the default option for Boolean and optionset type attributes.</summary>
///<returns type="Object"/>
},
getFormat: function () {
///<summary>Returns a string value that represents formatting options for the attribute.</summary>
///<returns type="String"/>
},
getIsDirty: function () {
///<summary>Returns a Boolean value indicating if there are unsaved changes to the attribute value.</summary>
///<returns type="Boolean"/>
},
getMax: function () {
///<summary>Returns a number indicating the maximum allowed value for an attribute.</summary>
///<returns type="Number"/>
},
getMaxLength: function () {
///<summary>Returns a number indicating the maximum length of a string or memo attribute.</summary>
///<returns type="Number"/>
},
getMin: function () {
///<summary>Returns a number indicating the minimum allowed value for an attribute.</summary>
///<returns type="Number"/>
},
getName: function () {
///<summary>Returns a string representing the logical name of the attribute.</summary>
///<returns type="String"/>
},
getOption: function (value) {
///<summary>Returns an option object with the name matching the argument passed to the method.</summary>
///<param name="value">String or Number value</param>
///<returns type="XrmTypes.Option"/>
},
getOptions: function () {
///<summary>Returns an array of option objects representing the valid options for an optionset attribute.</summary>
///<returns type="Array"/>
},
getParent: function () {
///<summary>Returns the entity object that is the parent to the attribute.</summary>
///<returns type="XrmTypes.Entity"/>
},
getPrecision: function () {
///<summary>Returns the number of digits allowed to the right of the decimal point.</summary>
///<returns type="Number"/>
},
getRequiredLevel: function () {
///<summary>Sets whether data is required or recommended for the attribute before the record can be saved. One of the values 'none', 'required', 'recommended'.</summary>
///<returns type="String"/>
},
getSelectedOption: function () {
///<summary>Returns the option object that is selected in an optionset attribute..</summary>
///<returns type="XrmTypes.Option"/>
},
getSubmitMode: function () {
///<summary>Returns a string indicating when data from the attribute will be submitted when the record is saved. One of the values 'allways', 'never', 'dirty'.</summary>
///<returns type="String"/>
},
getText: function () {
///<summary>Returns a string value of the text for the currently selected option for an optionset attribute.</summary>
///<returns type="String"/>
},
getUserPrivilege: function () {
///<summary>Returns an array of privileges that contain Boolean values indicating if the user can create, read or update data values for an attribute.</summary>
///<returns type="String"/>
},
getValue: function () {
///<summary>Retrieves the data value for an attribute.</summary>
///<returns type="Object"/>
},
removeOnChange: function (delegate) {
///<summary>Removes a function from the OnChange event hander for an attribute.</summary>
///<param name="delegate" type="Delegate"/>
},
setRequiredLevel: function (value) {
///<summary>Sets whether data is required or recommended for the attribute before the record can be saved.</summary>
///<param name="value" type="String">One of the values 'none', 'required', 'recommended'.</param>
},
setSubmitMode: function (value) {
///<summary>Sets whether data from the attribute will be submitted when the record is saved.</summary>
///<param name="value" type="String">One of the values 'none', 'required', 'recommended'.</param>
},
setValue: function (value) {
///<summary>Sets the data value for an attribute.</summary>
///<param name="value" type="Object"/>
}
};
XrmTypes.Option.prototype = {
text: '',
value: 0
}
XrmTypes.Lookup.prototype = {
entityType: '',
id: 0,
name: 0
}
XrmTypes.Context.prototype = {
getAuthenticationHeader: function () {
///<summary>Returns the encoded SOAP header necessary to use Microsoft Dynamics CRM 4.0 web service calls using Jscript. </summary>
///<returns type="String"/>
},
getCurrentTheme: function() {
///<summary>Returns a string representing the current Microsoft Office Outlook theme chosen by the user.</summary>
///<returns type="String"/>
},
getOrgLcid: function () {
///<summary>Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the base language for the organization. </summary>
///<returns type="Number"/>
},
getOrgUniqueName: function () {
///<summary>Returns the unique text value of the organizations name. </summary>
///<returns type="String"/>
},
getQueryStringParameters: function () {
///<summary>Returns an array of key value pairs representing the query string arguments that were passed to the page. </summary>
///<returns type="Array"/>
},
getServerUrl: function () {
///<summary>Returns the base server URL. When a user is working offline with the Microsoft Dynamics CRM for Microsoft Office Outlook client, the URL is to the local Microsoft Dynamics CRM Web services. </summary>
///<returns type="String"/>
},
getUserId: function () {
///<summary>Returns GUID value of the SystemUser.id value for the current user. </summary>
///<returns type="String"/>
},
getUserLcid: function () {
///<summary>Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the user selected as their preferred language. </summary>
///<returns type="Number"/>
},
getUserRoles: function () {
///<summary>Returns an array of strings representing the GUID values of each of the security roles that the user is associated with. </summary>
///<returns type="Array"/>
},
isOutlookClient: function() {
///<summary>Returns a Boolean value indicating if the user is using the Microsoft Dynamics CRM for Microsoft Office Outlook client.</summary>
//<returns type="Boolean"/>
},
isOutlookOnline: function() {
///<summary>Returns a Boolean value indicating whether the user is connected to the Microsoft Dynamics CRM server while using the Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access client. When this function returns false, the user is working offline without a connection to the server. They are interacting with an instance of Microsoft Dynamics CRM running on their local computer.</summary>
//<returns type="Boolean"/>
},
prependOrgName: function(sPath)
{
///<summary>Prepends the organization name to the specified path.</summary>
///<param name="sPath" type="String">A local path to a resource.</param>
///<returns type="String"/>
}
};
var Xrm = new XrmTypes.Xrm();
function GetGlobalContext() {
///<returns type="XrmTypes.Context"/>
}