简体   繁体   English

CRM Dynamics,如何使用一种形式传递值,并使用Xrm.Utility.openEntityForm()在新的Entity(form)中设置值;

[英]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.

相关问题 使用Xrm.Utility.openEntityForm()覆盖不同记录中的字段 - Using Xrm.Utility.openEntityForm() to override fields in different record Xrm.Utility.openEntityForm(entityType,null,参数) - Xrm.Utility.openEntityForm(entityType, null, parameters) 在Dynamics 365 CRM上使用Xrm Object将表单设置为只读 - Set form read only using Xrm Object on Dynamics 365 CRM Xrm.Utility.openEntityForm设置查找字段 - Xrm.Utility.openEntityForm setting Look Up field Dynamics CRM 2013:从实体设置表单中的默认值 - Dynamics CRM 2013: Setting default values in a form from an entity CRM 2011如何使用Java来使用子/相关实体表单中的值更新父实体字段 - CRM 2011 how to update a Parent entity field with values from a child/related entity form using Javascript 如何将 CRM Dynamics 2015 表单数据(归档值)传递到具有 JavaScript 功能的 HTML 页面 - How to pass CRM Dynamics 2015 Form data(filed values) to an HTML page which has JavaScript functions 如何从 JS Dynamics crm 打开新形式的捆绑包? - How to open a new form of bundle from JS Dynamics crm? Javascript-Dynamics CRM Online-通过openEntityForm将查找字段值传递给表单 - Javascript - Dynamics CRM Online - Passing a lookup field value to a form through openEntityForm React + Formik - 如何传入新值并将表单设置为脏? - React + Formik - how to pass in new values and set form as dirty?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM