Pages

Tuesday, 30 April 2013

How to open new record with existing record data when click on the button

The following code will helps you to open the lead record with some existing record data when click on the button but not save the opened record until click on the save button.

 
 
 
function createMultiple() {
    var features = "location=no,menubar=no,status=no,toolbar=no,resize=yes,height=850,width=1000 top=20";
    var compname = Xrm.Page.getAttribute("companyname").getValue();
    var leadid = Xrm.Page.data.entity.getId();
    var leadname=Xrm.Page.getAttribute("subject").getValue();
    var fn=Xrm.Page.getAttribute("firstname").getValue();
    var ln=Xrm.Page.getAttribute("lastname").getValue();
    var fax=Xrm.Page.getAttribute("fax").getValue();
    var extraqs = "companyname=" + compname;
        extraqs+="&subject="+leadname;
        extraqs+="&firstname="+fn;
        extraqs+="&fax="+fax;
        extraqs+="&lastname="+ln;
    window.open(Xrm.Page.context.getServerUrl() + "/main.aspx?etn=lead&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs), "_blank", features, false);
}

No comments:

Post a Comment