I have written the below function :
function openConnectionForm() {
"use strict";
var parameters = {};
var id = Xrm.Page.data.entity.getId();
id = id.substr(1);
id = id.slice(0,-1);
parameters["record1id"] = id;
alert(id);
var entityName = "connection";
var windowOptions = {
openInNewWindow: true
};
Xrm.Utility.openEntityForm(entityName, null, parameters, windowOptions);
}
I have a ribbon button "Connect". When I click that button, I want to open Connections form and I want to pre populate the field "record1id" with the guid of the record on which I click the ribbon button.
The form is opening on clicking the ribbon button. But, the field "record1id" is not populated as expected. Some garbage guid is added.
What am I doing wrong?
Update :
I have changed the code to :
var id = Xrm.Page.data.entity.getId();
var name = Xrm.Page.getAttribute("fullname").getValue();
alert(id);
alert(name);
var parameters = {};
parameters["record1id"] = id;
parameters["record1idname"] = name;
var entityName = "connection";
var windowOptions = {
openInNewWindow: true
};
alert("Done");
Xrm.Utility.openEntityForm(entityName, null, parameters, windowOptions);
alert("Form Opened");
The form is opening.