Here is a common script for copy all values from one entity to another - I'm sure you can look at it and get some ideas
if (crmForm.all.new_incomingcustomeraccountid.DataValue != null)
{
var id = crmForm.all.new_incomingcustomeraccountid.DataValue[0].id;
//alert(id);
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"schemas.xmlsoap.org/.../envelope\" xmlns:xsi=\"www.w3.org/.../XMLSchema-instance\" xmlns:xsd=\"www.w3.org/.../XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"schemas.microsoft.com/.../WebServices\">" +
" <query xmlns:q1=\"schemas.microsoft.com/.../Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>account</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>accountid</q1:Attribute>" +
" <q1:Attribute>address1_line1</q1:Attribute>" +
" <q1:Attribute>address1_line2</q1:Attribute>" +
" <q1:Attribute>address1_city</q1:Attribute>" +
" <q1:Attribute>address1_country</q1:Attribute>" +
" <q1:Attribute>address1_postalcode</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>"+
" <q1:Value xsi:type=\"xsd:string\">"+ id +"</q1:Value>"+
" </q1:Values>"+
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML.xml;
//alert(resultXml );
if (resultXml != null || resultXml != "")
{
var xmlDocument =new ActiveXObject("Microsoft.XMLDOM");
var bLoaded = xmlDocument.loadXML(resultXml);
if (bLoaded)
try
{
var Line1 = xmlDocument.selectSingleNode("//BusinessEntity/q1:address1_line1").text;
crmForm.all.new_address1.DataValue = Line1;
crmForm.all.new_address1.ForceSubmit = true;
}
catch(err){
alert ("Line 1 Missing");
crmForm.all.new_address1.DataValue ='';
}
try
{
var Line2 = xmlDocument.selectSingleNode("//BusinessEntity/q1:address1_line2").text;
crmForm.all.new_address2.DataValue = Line2;
crmForm.all.new_address2.ForceSubmit = true;
}
catch(err){
alert ("Line 2 Missing");
crmForm.all.new_address2.DataValue ='';
}
try
{
var Line3= xmlDocument.selectSingleNode("//BusinessEntity/q1:address1_city").text;
crmForm.all.new_address3.DataValue = Line3;
crmForm.all.new_address3.ForceSubmit = true;
}
catch(err){
alert ("Town Missing");
crmForm.all.new_address3.DataValue ='';
}
try
{
var Line4= xmlDocument.selectSingleNode("//BusinessEntity/q1:address1_country").text;
crmForm.all.new_address4.DataValue = Line4;
crmForm.all.new_address4.ForceSubmit = true;
}
catch(err){
alert ("County Missing");
crmForm.all.new_address4.DataValue ='';
}
try
{
var Line5= xmlDocument.selectSingleNode("//BusinessEntity/q1:address1_postalcode").text;
crmForm.all.new_postcode.DataValue = Line5;
crmForm.all.new_postcode.ForceSubmit = true;
}
catch(err){
alert ("Post Code Missing");
crmForm.all.new_postcode.DataValue = '';
}
}
}