自定义动力学crm中的控件

时间:2010-11-02 11:26:21

标签: asp.net custom-controls customization dynamics-crm dynamics-crm-4

我编写的代码可以让手机通过功能调用拨打号码,这已经完成并且已经尘埃落定。

我想要实现的是在Dynamics CRM中的表单上的每个电话号码字段中添加一个“拨号”按钮。最终,这还可以创建一个新的电话记录填写基本详细信息,并显示给用户输入注释和电话结果,以及可能还有一些其他工作流位来安排下一个电话。

我可以在标准表单上放置自定义控件来代替标准控件。我假设它必须是一个asp.net页面的IFrame,它拉入记录ID,字段名称,查找要在文本框中显示的数字,并将数字传递给DialNumber函数。嘿presto ...

我认为它不会那么容易......有没有人试过这个,过程是什么,有什么问题?

1 个答案:

答案 0 :(得分:3)

我通过在电话领域放置一些html(div和锚点)解决了这个问题。下面的代码在给定字段的文本框末尾放置一个电话图标。

crmForm.ApplyClickToDial= function(field, href){
var phoneField = field;
phoneField.style.position = "relative";

var imgAnchor = document.createElement("a");
phoneField.appendChild(imgAnchor);

imgAnchor.href=href;
imgAnchor.style.position = "absolute";
imgAnchor.style.right = ".5em";
imgAnchor.style.top=".5em";

var image = document.createElement("img");
image.src ="/_imgs/ico_16_4210.gif";
imgAnchor.appendChild(image);
}

var mobileNumber = crmForm.all.mobilephone.DataValue;
crmForm.ApplyClickToDial(crmForm.all.mobilephone_d, "http://callphone/" + mobileNumber );  /*  the "_d"  represents the control's encompassing td element*/