4

Xrm.Utility.openEntityForm() メソッドを使用して新しいカスタム エンティティ フォームを開き、エンティティ ルックアップ フィールドをプログラムで設定しようとしています。http://msdn.microsoft.com/en-us/library/gg334375.aspxの例を非常に厳密にフォローしていますが、説明のないエラーが発生しています。実際にフィールドを設定したり、エラーのログを見つけたりするための助けをいただければ幸いです。

私がフォローしているコード例。

 function OpenNewContact() {

 var parameters = {};

 //Set the Parent Customer field value to “Contoso”.
 parameters["parentcustomerid"] = "2878282E-94D6-E111-9B1D-00155D9D700B";
 parameters["parentcustomeridname"] = "Contoso";
 parameters["parentcustomeridtype"] = "account";

 //Set the Address Type to “Primary”.
 parameters["address1_addresstypecode"] = "3";

 //Set text in the Description field.
 parameters["description"] = "Default values for this record were set programmatically.";
 //Set Do not allow E-mails to "Do Not Allow".
 parameters["donotemail"] = "1";

 // Open the window.
 Xrm.Utility.openEntityForm("contact", null, parameters);
}

カスタム エンティティで同じことを行うために作成した関数は次のとおりです。

function createNewService() {
    var locationId = trimBrackets(Xrm.Page.data.entity.getId());

    var primaryField = Xrm.Page.data.entity.getPrimaryAttributeValue();

    var entityLogicalName = Xrm.Page.data.entity.getEntityName();

    var parameters = {
        cw_location: locationId,
        cw_locationname: primaryField,
        cw_locationtype: entityLogicalName
    };

    Xrm.Utility.openEntityForm("cw_service", null, parameters);

}

フォームを開いているエンティティの名前 = cw_service (Xrm.Utility.openEntityForm("cw_service"); で空白のフォームを開くことができるため、これは問題ではありません)

設定しようとしているフィールドの名前は cw_location です。

エラーメッセージの写真を投稿したいのですが、まだそれを行う評判がありません.

4

1 に答える 1