Advertisements

Archive

Posts Tagged ‘webresource’

Xrm.Utility functions to open Entity forms or Web resources

November 1, 2012 1 comment

In CRM, we can open the entity forms using “window.open” method

  • With UR 8, a couple new client-side JavaScript functions were added to open entity forms and web resources
  • These functions fixes the prompt the user to login again issue when you use “window.open” to open form or web resource from CRM online/Outlook client

Xrm.Utility

The Xrm.Utility object provides a container for useful functions. Following MSDN blog which talks extensively on the same

For quick glance below are few samples

Open a new “Account” record form

Xrm.Utility.openEntityForm(“account”); // Pass ‘Account’ schema name

Open an existing “Account” record form

Xrm.Utility.openEntityForm(“account”,”A85C0252-DF8B-E111-997C-00155D8A8410″); // Pass ‘Account’ schema name & GUID

Open a new “Account” record form and setting default values

var parameters = {};

parameters[“formid”] = “b053a39a-041a-4356-acef-ddf00182762b”;

parameters[“name”] = “Test”;

parameters[“telephone1”] = “(425) 555-1234”;

Xrm.Utility.openEntityForm(“account”, null, parameters);

Open an HTML web resource named “new_webResource.htm”

Xrm.Utility.openWebResource(“new_webResource.htm”);

🙂

Advertisements

Loading dependent jscript libraries in ribbon button’s execution CRM 2011

Hi,

I have a ribbon button on my “Account” main grid .

I am calling function “sayHello” which is in my web resource “account_ribbon” by defining custom action like below.

<Actions>

<JavaScriptFunction Library=”$webresource:account_ribbon” FunctionName=”sayHello”>

</JavaScriptFunction>

</Actions>

Now the problem is, I need to call another method from my “sayHello” function, which is in other web resource “common”.

Solution :-

The solution is simple. We can add all the required libraries to <Actions> node like below

 <JavaScriptFunction Library=”$webresource:common” FunctionName=”isNaN” />

Note – Since <JavaScriptFunction> requires a function name, pass “isNaN”.

Now my <Actions> node look like below

<Actions>

<JavaScriptFunction Library=”$webresource:account_ribbon” FunctionName=”sayHello”>

</JavaScriptFunction>

<JavaScriptFunction Library=”$webresource:common” FunctionName=”isNaN”>

</JavaScriptFunction>

</Actions>

🙂