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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.05.2009, 06:07   #1  
Blog bot is offline
Blog bot
Участник
 
25,607 / 848 (80) +++++++
Регистрация: 28.10.2006
mscrm4ever: CRM 4.0 Embedding User Signature in CRM Web Client
Источник: http://mscrm4ever.blogspot.com/2009/...re-in-crm.html
==============

One of the main features that the CRM email web client is missing is an automatic stationary signature. Although a user (or an administrator) can create a predefined signature and embed it before sending the email the web client requires the user to fill the TO (or CC) field in advance and then pick out the signature template using the Insert Template button. For most of us who gotten used to using advanced editors like outlook this seems like a major step backwards.

In order to enhance the user experience and demonstrate to strength and simplicity of dynamics while I’m at it I wrote a post that automates the process. The automated signature makes use of CRM’s email template feature. Once the Global email template (signature) is in place you need to extract its id (templateid) and use it in your code.

In order to retrieve the template id you can run this following query against the filteredtemplate view:

SELECT TEMPLATEID FROM FILTEREDTEMPLATE WHERE TITLE = ‘USER SIGNATURE’


The nice thing about dynamics is that most UI features also have an API manifestation. In this case it’s the ability to instantiate email templates by using the InstantiateTemplateRequest. The InstantiateTemplateRequest receives a templateid, objectid and objecttype. The objectid and type are used as context so the template is able to retrieve information that is specific to the recipient entity. Since we are only interested in the user information the objectid and type are field with the email owner which is the current user.

Copy the following code to the email onload event and enjoy…


function Signature(companyTemplateId)
{
var sig = this;
var emailIframe;
var emailBody;

sig.TemplateId = companyTemplateId;

sig.Load = function()
{
try
{
var xml = "" +
"" +
"" +
GenerateAuthenticationHeader() +
" " +
" " +
" " +
" " + sig.TemplateId + "" +
" " + crmForm.ownerid.DataValue[0].typename + "" +
" " + crmForm.ownerid.DataValue[0].id + "" +
" " +
" " +
" " +
"" +
"";

var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);

var resultXml = xmlHttpRequest.responseXML;
if (xmlHttpRequest.status == 200)
{
emailBody = resultXml.selectSingleNode("//q1:description").text;
}
}
catch(err)
{
alert(err.description);
}
}

function emailIframeReady()
{
if (emailIframe.readyState != 'complete')
{
return;
}

emailIframe.contentWindow.document.body.innerHTML = emailBody;
}

emailIframe = document.all.descriptionIFrame;
emailIframe.onreadystatechange = emailIframeReady;
}

function OnCrmPageLoad()
{
if (crmForm.FormType == 1)
{
var signature = new Signature("30875359-3c4d-de11-9cf8-0003ff230264");
signature.Load();
}
}

OnCrmPageLoad();



Источник: http://mscrm4ever.blogspot.com/2009/...re-in-crm.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: Troubleshooting the Microsoft Dynamics CRM Client for Outlook Blog bot Dynamics CRM: Blogs 0 30.05.2009 12:05
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0: Understanding Connections Blog bot Dynamics CRM: Blogs 0 20.01.2009 02:07
Microsoft Dynamics CRM Team Blog: Trust for Delegation in List Web Part for Microsoft Dynamics CRM 4.0 Blog bot Dynamics CRM: Blogs 0 15.01.2009 03:13

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:57.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.