AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.07.2012, 01:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: New Xrm.Utility Functions in Update Rollup 8 for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online
Источник: http://blogs.msdn.com/b/crm/archive/...rm-online.aspx
==============

Update Rollup 8 for Microsoft Dynamics CRM 2011 was released in May but we didn’t provide an SDK update for it. As a result you probably haven’t seen a couple new client-side JavaScript functions that were added to open entity forms and web resources.
These functions were added because with Microsoft Dynamics CRM Online scripts that used window.open in the Outlook client to open a Microsoft CRM page like a form or web resource would prompt the user to login again. The reason was that calling this function would open a new unauthenticated process. The fix added in update rollup 8 was to provide some wrapper functions so that custom JavaScript functions can use the already authenticated process.
The following is a preview of the reference topic that will be included in the next SDK update.

Xrm.Utility Reference

The Xrm.Utility object provides a container for useful functions not directly related to the current page.
These functions are available in every application page that supports scripting. You can use them in form scripts or in ribbon commands. For HTML web resources, they are available when you include the ClientGlobalContext.js.aspx page. For more information, see ClientGlobalContext.js.aspx.

Functions

The following table lists the functions of Xrm.Utility.

FunctionDescriptionopenEntityFormOpens an entity form.openWebResourceOpens an HTML web resource.openEntityForm

Opens an entity form.

Xrm.Utility.openEntityForm(name,id,parameters)Parameters
  • name
    • Type: String
    • Required: The logical name of an entity.
  • id
    • Type: String
    • Optional: The string representation of a unique identifier or the record to open in the form. If not set, a form to create a new record is opened.
  • parameters
    • Type: Object
    • Optional: A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error.

      Valid extra query string parameters are:
Return Value: Window object.

Remarks: This function provides a better developer experience than the process of manipulating the URL passed to the window.open method described in Open Forms, Views, and Dialogs with a URL. Using this function also helps ensure that users are not prompted to log in again under certain circumstances.

Examples:

Open a new account record

Xrm.Utility.openEntityForm("account");

Open an existing account record

Xrm.Utility.openEntityForm("account","A85C0252-DF8B-E111-997C-00155D8A8410");

Open a new account record with a specific 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 a new contact record, move it to the top left corner of the screen, and set the size of the window

Note

You cannot use window object methods such as moveTo or resizeTo in scripts that will run in Microsoft Dynamics CRM for Microsoft Office Outlook.


var newWindow = Xrm.Utility.openEntityForm("contact");newWindow.moveTo(0,0);newWindow.resizeTo(800,600);openWebResource

Opens an HTML web resource.

Xrm.Utility.openWebResource(webResourceName,webResourceData,width, height)Parameters
  • webResourceName
    • Type: String
    • Required: The name of the HTML web resource to open.
  • webResourceData
    • Type: String
    • Optional: Data to be passed into the data parameter.
  • width
    • Type: Number
    • Optional: The width of the window to open in pixels.
  • height
    • Type: Number
    • Optional: The height of the window to open in pixels.
Return Value: Window object.

Remarks: An HTML web resource can accept the parameter values described in Passing Parameters to HTML Web Resources . This function only provides for passing in the optional data parameter. To pass values for the other valid parameters, you must append them to the webResourceName parameter.

Examples:

Open an HTML web resource named “new_webResource.htm”:

Xrm.Utility.openWebResource("new_webResource.htm");

Open an HTML web resource including a single item of data for the data parameter”

Xrm.Utility.openWebResource("new_webResource.htm","dataItemValue");

Open an HTML web resource passing multiple values through the data parameter

var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");Xrm.Utility.openWebResource("new_webResource.htm",customParameters);Note

These values have to be extracted from the value of the data parameter in the HTML web resource. For more information, see Sample: Pass Multiple Values to a Web Resource Through the Data Parameter.




Open an HTML web resource with the parameters expected by HTML web resources:

Xrm.Utility.openWebResource("new_webResource.htm?typename=account&userlcid=1033");For more information, see Passing Parameters to HTML Web Resources .



Open an HTML web resource, setting the height and width:

Xrm.Utility.openWebResource("new_webResource.htm", null, 300,300);


Источник: http://blogs.msdn.com/b/crm/archive/...rm-online.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 8 Blog bot Dynamics CRM: Blogs 1 30.04.2016 10:26
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 7 Blog bot Dynamics CRM: Blogs 0 27.03.2012 02:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 4 Blog bot Dynamics CRM: Blogs 0 24.09.2011 01:16
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 2011 ~ Online Test Drive Guide Blog bot Dynamics CRM: Blogs 0 05.08.2011 20:13
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:25.