Wednesday, March 25, 2009
Global Javascript Functions in MS CRM 4.0
Global functions provide information about the client application and whether the user is working online.
The following table shows the available global functions.
IsOnline : Checks whether the client application for which this page is rendered is online or offline.
IsOutlookClient :Checks whether the form is shown on either Microsoft Dynamics CRM for Microsoft Office Outlook or Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access.
IsOutlookLaptopClient : Checks whether the form is shown on Microsoft Dynamics CRM for Outlook with Offline Access.
IsOutlookWorkstationClient : Checks whether the form is shown on Microsoft Dynamics CRM for Outlook.
GenerateAuthenticationHeader : Returns a string that represents a correctly formed Microsoft Dynamics CRM authentication header used when making Web service calls with Microsoft Dynamics CRM Web services.
PrependOrgName : Prepends the organization name to the specified path.
Global Javascript Variables in MS CRM 4.0
Global variables provide information about the Microsoft Dynamics CRM deployment and options chose by the user. Below Global variables you can use in ISV, Event Scripts of forms and across all CRM Web Pages.
The following table shows the available global variables.
SERVER_URL : Provides a string that represents the base server URL. When a user is offline, the SERVER_URL points to the local Microsoft Dynamics CRM Web services.
USER_LANGUAGE_CODE : Provides an LCID value that represents the Microsoft Dynamics CRM Language Pack that the user has selected.
ORG_LANGUAGE_CODE : Provides an LCID value that represents the Microsoft Dynamics CRM Language Pack that is the base language for the organization.
ORG_UNIQUE_NAME : Provides the unique text value of the organizations name.
Example
This script displays the values of these global variables.
alert("SERVER_URL="+SERVER_URL );
alert("USER_LANGUAGE_CODE="+USER_LANGUAGE_CODE);
alert("ORG_LANGUAGE_CODE="+ORG_LANGUAGE_CODE);
alert("ORG_UNIQUE_NAME="+ORG_UNIQUE_NAME);
There is an error in xml document (Row, column)
Are you getting this error When Calling retrieve(), retrieveMultiple() ..... and so on CRM Methods ?
The solution is very simple:
remove the existing CRM Web services and Add them again (CrmService, Discovery, Metadata).
Recompile and Run your application.
Posted by
Dynamics 365 Solution Architect | Azure / ALM/DevOps | Power Platform
at
11:04 PM
No comments:
Labels:
MS CRM
Wednesday, February 18, 2009
Get Dynamic Entity Primary Attribute Guid Example
Example by CrmSdk
public Guid GetDynamicEntityPrimaryAttributeGuid(DynamicEntity entity){ if (entity != null) { string strPrimaryKeyAttributeName = entity.Name.ToLower() + "id"; return ((Microsoft.Crm.Sdk.Key)entity.Properties[strPrimaryKeyAttributeName]).Value; } return Guid.Empty;}
Example by Web Service
public Guid GetDynamicEntityPrimaryAttributeGuid(DynamicEntity entity){ if (entity != null) { string strPrimaryKeyAttributeName = entity.Name.ToLower() + "id"; for (int i = 0; i < entity.Properties.Length; i++) { if (entity.Properties[i].Name.ToLower() == strPrimaryKeyAttributeName) { KeyProperty property = (KeyProperty)entity.Properties[i]; return property.Value.Value; } } } return Guid.Empty;}Create Dynamic Entity Record Example
StringProperty firstname = new StringProperty();firstname.Name = "firstname";firstname.Value = "Ranjit";
StringProperty lastname = new StringProperty();lastname.Name = "lastname";lastname.Value = "Singh";
// Create the DynamicEntity object.DynamicEntity contactEntity = new DynamicEntity();
// Set the name of the entity type.contactEntity.Name = EntityName.contact.ToString();
// Set the properties of the contact.contactEntity.Properties = new Property[] {firstname, lastname};
// Create the target.TargetCreateDynamic targetCreate = new TargetCreateDynamic();targetCreate.Entity = contactEntity;
// Create the request object.CreateRequest create = new CreateRequest();
// Set the properties of the request object.create.Target = targetCreate;
// Execute the request.CreateResponse created = (CreateResponse) service.Execute(create);
Subscribe to:
Posts (Atom)