[英]CRM Dynamics , How to pass values from one form and set the values in a new Entity(form) using Xrm.Utility.openEntityForm();
I have written a JavaScript function that opens a new Phone Call Entity form from ribbon button clicked in the Contact form. 我编写了一个JavaScript函数,该函数可以通过从“联系人”表单中单击的功能区按钮打开一个新的“电话实体”表单。 I have managed to pass open the new phone call, however I am battling toi find a way to set the values from contact in the nerw phone call form.
我设法打开了新电话,但是我正在努力寻找一种方法来设置nerw电话表单中来自联系人的值。 Please view my code below
请在下面查看我的代码
function OpenPhoneCall()
{
Xrm.Utility.openEntityForm("phonecall",null,parameters);
}
This works fine,it redirects to phone call and all, my challenge is passing values from the Contact to Phone Call entity, I saw examples that only set default values, I want to make it generic and set let it read the values in Contact and set them in the Phone Call form. 它可以正常工作,它可以重定向到电话,所有,我的挑战是将值从“联系人”传递到“电话”实体,我看到了仅设置默认值的示例,我想使其通用并设置以使其读取Contact和在“电话”表单中进行设置。
Please look at the full Code below to get the parameters from the Contact, now how do I set them in Phone Call: 请查看下面的完整代码,以从联系人获取参数,现在如何在“电话呼叫”中设置它们:
function OpenPhoneCall() {
var parameters =
{
numberToDial:Xrm.Page.getAttribute("mobilephone").getValue(),
mobileUserName :Xrm.Page.getAttribute("new_receivecallon").getValue(),
mobileUserPassword: Xrm.Page.getAttribute("telephone1").getValue()
};
Xrm.Utility.openEntityForm("phonecall",null,parameters);
}
I would really appreciate some advice on how to archive this, as I see many examples on the net show how to set default values, NOTE: I am passing null for second parameter in the openEntityForm JS Method as I do not want to open an existing record, a new one. 我真的很感谢有关如何存档此文件的一些建议,因为我在网上看到许多示例显示了如何设置默认值,但是,由于我不想打开现有文件,因此我在openEntityForm JS方法中为第二个参数传递了null记录,一个新的。 Thanks in advance.
提前致谢。
Your code is correct, the error is in the field names in parameters. 您的代码正确,错误在于参数的字段名称中。
Example: open a phone call from a contact, grabbing the mobile number and using it as phone number of the activity: 示例:从联系人打开电话,获取手机号码并将其用作活动的电话号码:
var params = {
phonenumber: Xrm.Page.getAttribute('mobilephone').getValue()
};
Xrm.Utility.openEntityForm("phonecall", null, params);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.