Answered by:
Opportunity Calculation Sheet Entity

Question
-
Hello,
I' ve created a new entity Calculation, which is linked with the opportunity. 1:n
Our Sales Manager calulates all their "products" they want to sell. For each product they create a new Calculation. So it is like a CRM Product.
After that with the opportunity should create a new quote.And in this new quote I want to Retrieve all this "Calculation Products" and want to create new manual CRM Products in the quotedetail mask.
So the code have to look in the opportunity and fetch all the Calculations Sheets which are linked with it.Is that possible with a custom action button in the quote entity.
Best Regards
Andreas
Wednesday, August 18, 2010 11:49 AM
Answers
-
var oppid = crmForm.all.opportunityid.DataValue[0].id; var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader()+ "<soap:Body>"+ "<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+ " xsi:type='q1:QueryExpression'>"+ "<q1:EntityName>new_kalkulation</q1:EntityName>"+ "<q1:ColumnSet xsi:type='q1:ColumnSet'>"+ "<q1:Attributes>"+ "<q1:Attribute>new_namebez</q1:Attribute>" + "<q1:Attribute>new_stdart</q1:Attribute>" + "<q1:Attribute>new_anzahl</q1:Attribute>" + "<q1:Attribute>new_vkpreiseu</q1:Attribute>" + "<q1:Attribute>new_kalkid</q1:Attribute>" + "<q1:Attribute>new_kalkulationid</q1:Attribute>" + "</q1:Attributes>"+ "</q1:ColumnSet>"+ "<q1:Distinct>false</q1:Distinct>"+ "<q1:Criteria>"+ "<q1:FilterOperator>And</q1:FilterOperator>"+ "<q1:Conditions>"+ "<q1:Condition>"+ "<q1:AttributeName>new_kalkid</q1:AttributeName>"+ "<q1:Operator>Like</q1:Operator>"+ "<q1:Values>"+ "<q1:Value xsi:type='xsd:string'>"+oppid+"</q1:Value>"+ "</q1:Values>"+ "</q1:Condition>"+ "</q1:Conditions>"+ "</q1:Criteria>"+ "</query>"+ "</RetrieveMultiple>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; //alert(resultXml); // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; alert(msg); } // Parse and display the results. else { var results = resultXml.getElementsByTagName('BusinessEntity'); var msg = ""; if (results.length == 0) { msg = "No kalkulation Associated"; alert(msg); return; } else { for (i=0;i < results.length;i++) { var ArtikelName = results[i].selectSingleNode('./q1:new_namebez').nodeTypedValue; var ArtikelAnzahl = results[i].selectSingleNode('./q1:new_anzahl').nodeTypedValue; var ArtikelPreis = results[i].selectSingleNode('./q1:new_vkpreiseu').nodeTypedValue; var name = results[i].selectSingleNode('./q1:new_kalkulationid').nodeTypedValue; msg += ArtikelName +"\t"+ ArtikelAnzahl +"\t" + ArtikelPreis + "\n" + name +"\r"; } alert(msg); } }
Hi,
ok I have a very good response from the fetch xml. Thank you for your development.
And now I want to create the different quotedetail products with the result of the xml request. The Script should start with an Action Button in my navigation panel.
I don't know how I transfer the result of the fetch xml into my CRM SDK Webservices.Regards,
Andreas
- Marked as answer by Andreas_Mueller Wednesday, September 1, 2010 2:31 PM
Wednesday, September 1, 2010 12:26 PM
All replies
-
Hi,
You can get this done using Plug-ins. You need to create a plug-in which will execute once you generate a new quote.
In that plug-in you can extract all "Calculation Products" and add new products to the quote as per the requirements.
Hope this helps.
Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant- Proposed as answer by Ranjitsingh R Wednesday, August 18, 2010 12:22 PM
Wednesday, August 18, 2010 12:22 PM -
1. I am not clear about the senario, however if the relationship between calculations and quotedetail is 1 to 1 than you can use quotedetails entity for calculations.
2. You can use Javascripts (will only work with front end), Workflows or Plugin to update calculations for the child entity to Quote entity (parent entity).
Regards
Faisal
Wednesday, August 18, 2010 2:35 PM -
1. I am not clear about the senario, however if the relationship between calculations and quotedetail is 1 to 1 than you can use quotedetails entity for calculations.
2. You can use Javascripts (will only work with front end), Workflows or Plugin to update calculations for the child entity to Quote entity (parent entity).
Regards
Faisal
Hi,1. No, the calculation entity is linked only to the opportunity. And now our Sales Backoffice Team creates the quote. And their should be an action button to retrieve the differents products from the opportunity-calculations sheets. In the calculation entity is the opportuinity id linked.
MyOpinion with some Pseudo Code:
Action Button (RetrieveProducts) in quote .clicked.
SQL Statement:
Select * from new_Calculation where opportunityid = @opportunityid (fromthe quote-entity)
Put these data into a datatable
And create the manual products into the quote-detail entity.
This is my solution. But how works it on CRM-Side.
Regards,Andreas
Wednesday, August 18, 2010 2:57 PM -
Hi Andreas,
I am still not sure whether I understand your requirements correctly.
Suppose if you can create a similar relationship of Calculation with Quote as you have already done with opportunity. Using workflow, on create of Quote just update the relation field (say QuoteCalculation). By doing this same calculations will be linked with opportunity as well as quote. Will that be helpful?
Regards
Faisal
Wednesday, August 18, 2010 3:25 PM -
Hi,
Ok will try to explain it again.
Opportunity and Calculation are linked 1:n thats easy.
After our Sales Team have created the opportunity with all the requiered informations and fields; the Backoffice will receive an email that the Sales Manager want to create or send out an Quote. Our Backoffice Team create a template in a word document. And in the quote entity our backoffice team add the different CRM Products into the quote detail entity manually.And at this point I want to Retrieve the "Calculation Products" from the Opportunity - Calculation Entity and I will request them and then insert it automatically into the quote detail entity.
This is the way I want to go.
Best Regards,
Andreas
Thursday, August 19, 2010 2:24 PM -
Hi,
Ok will try to explain it again.
Opportunity and Calculation are linked 1:n thats easy.
After our Sales Team have created the opportunity with all the requiered informations and fields; the Backoffice will receive an email that the Sales Manager want to create or send out an Quote. Our Backoffice Team create a template in a word document. And in the quote entity our backoffice team add the different CRM Products into the quote detail entity manually.And at this point I want to Retrieve the "Calculation Products" from the Opportunity - Calculation Entity and I will request them and then insert it automatically into the quote detail entity.
This is the way I want to go.
Best Regards,
Andreas
Hi,I' ve found a CRM blog which shows exactly my development.
This is the link: https://www.blogger.com/comment.g?blogID=831461106785467893&postID=7261380014910400994
Best Regards,
Andreas
Tuesday, August 24, 2010 1:05 PM -
Hi,
her is my draft for the Fetch XMl Request. This will start when I Create a new quote.
alert(crmForm.all.opportunityid.DataValue[0].id); alert(crmForm.all.opportunityid.DataValue[0].name); alert(crmForm.all.opportunityid.DataValue[0].typename); var oppid; oppid = crmForm.all.opportunityid.DataValue[0].id; var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + " <soap:Header>" + " <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + " <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>" + " <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">XXXXXXXX</OrganizationName + " <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>" + " </CrmAuthenticationToken>" + " </soap:Header>" + " <soap:Body>" + " <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + " <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" + " <q1:EntityName>new_kalkulation</q1:EntityName>" + " <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + " <q1:Attributes>" + " <q1:Attribute>new_namebez</q1:Attribute>" + " <q1:Attribute>new_stdart</q1:Attribute>" + " <q1:Attribute>new_anzahl</q1:Attribute>" + " <q1:Attribute>new_vkpreiseu</q1:Attribute>" + " <q1:Attribute>new_kalkid</q1:Attribute>" + " </q1:Attributes>" + " </q1:ColumnSet>" + " <q1:Distinct>false</q1:Distinct>" + " <q1:Criteria>" + " <q1:Filteroperator>And</q1:FilterOperator>" + " <q1:Conditions>" + " <q1:Condition>" + " <q1:AttributeName>new_kalkid</q1:AttributeName>" + " <q1:Operator>Equal</q1:Operator>" + " <q1:Values>" + " <q1:Value>" + oppid + "</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","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); var resultXml = xmlHttpRequest.responseXML; alert(resultXml.xml); >"
But with it I have some trouble with the Criteria. How is the correct syntax?
" <q1:Criteria>" + " <q1:Filteroperator>And</q1:FilterOperator>" + " <q1:Conditions>" + " <q1:Condition>" + " <q1:AttributeName>new_kalkid</q1:AttributeName>" + " <q1:Operator>Equal</q1:Operator>" + " <q1:Values>" + " <q1:Value>" + oppid + "</q1:Value>" + " </q1:Values>" + " </q1:Condition>" + " </q1:Conditions>" + " </q1:Criteria>" +
After that I want to Create for each xml responding Kalkulation Sheet a new opportunitydetail dataset.
Please give me some hints.
Best Regards,
Andreas
Thursday, August 26, 2010 12:25 PM -
First of all we will retvieve all the calculations related with certain opportunity. Put the following code on load of quote entity and check the alert which you will get.
var oppid = crmForm.all.opportunityid.DataValue[0].id; // Prepare the SOAP message. var xml = "<?xml version='1.0' encoding='utf-8'?>"+ "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+ " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ authenticationHeader+ "<soap:Body>"+ "<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+ " xsi:type='q1:QueryExpression'>"+ "<q1:EntityName>new_kalkulation</q1:EntityName>"+ "<q1:ColumnSet xsi:type='q1:ColumnSet'>"+ "<q1:Attributes>"+ "<q1:Attribute>new_namebez</q1:Attribute>" + "<q1:Attribute>new_stdart</q1:Attribute>" + "<q1:Attribute>new_anzahl</q1:Attribute>" + "<q1:Attribute>new_vkpreiseu</q1:Attribute>" + "<q1:Attribute>new_kalkid</q1:Attribute>" + "</q1:Attributes>"+ "</q1:ColumnSet>"+ "<q1:Distinct>false</q1:Distinct>"+ "<q1:Criteria>"+ "<q1:FilterOperator>And</q1:FilterOperator>"+ "<q1:Conditions>"+ "<q1:Condition>"+ "<q1:AttributeName>new_kalkid</q1:AttributeName>"+ "<q1:Operator>Like</q1:Operator>"+ "<q1:Values>"+ "<q1:Value xsi:type='xsd:string'>"+oppid+"</q1:Value>"+ "</q1:Values>"+ "</q1:Condition>"+ "</q1:Conditions>"+ "</q1:Criteria>"+ "</query>"+ "</RetrieveMultiple>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; alert(resultXml); // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; alert(msg); } // Parse and display the results. else { var results = resultXml.getElementsByTagName('BusinessEntity'); var msg = ""; if (results.length == 0) { msg = "No kalkulation Associated"; alert(msg); return; } else { for (i=0;i < results.length;i++) { var idValue = results[i].selectSingleNode('./q1:new_namebez').nodeTypedValue; var name = results[i].selectSingleNode('./q1:new_kalkid').nodeTypedValue; msg += idValue +"\t"+ name+"\r"; } alert(msg); } }
let me know the outcome and than we can proceed further.
Regards
Faisal
Thursday, August 26, 2010 1:46 PM -
var oppid = crmForm.all.opportunityid.DataValue[0].id; var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader()+ "<soap:Body>"+ "<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+ " xsi:type='q1:QueryExpression'>"+ "<q1:EntityName>new_kalkulation</q1:EntityName>"+ "<q1:ColumnSet xsi:type='q1:ColumnSet'>"+ "<q1:Attributes>"+ "<q1:Attribute>new_namebez</q1:Attribute>" + "<q1:Attribute>new_stdart</q1:Attribute>" + "<q1:Attribute>new_anzahl</q1:Attribute>" + "<q1:Attribute>new_vkpreiseu</q1:Attribute>" + "<q1:Attribute>new_kalkid</q1:Attribute>" + "<q1:Attribute>new_kalkulationid</q1:Attribute>" + "</q1:Attributes>"+ "</q1:ColumnSet>"+ "<q1:Distinct>false</q1:Distinct>"+ "<q1:Criteria>"+ "<q1:FilterOperator>And</q1:FilterOperator>"+ "<q1:Conditions>"+ "<q1:Condition>"+ "<q1:AttributeName>new_kalkid</q1:AttributeName>"+ "<q1:Operator>Like</q1:Operator>"+ "<q1:Values>"+ "<q1:Value xsi:type='xsd:string'>"+oppid+"</q1:Value>"+ "</q1:Values>"+ "</q1:Condition>"+ "</q1:Conditions>"+ "</q1:Criteria>"+ "</query>"+ "</RetrieveMultiple>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; //alert(resultXml); // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; alert(msg); } // Parse and display the results. else { var results = resultXml.getElementsByTagName('BusinessEntity'); var msg = ""; if (results.length == 0) { msg = "No kalkulation Associated"; alert(msg); return; } else { for (i=0;i < results.length;i++) { var ArtikelName = results[i].selectSingleNode('./q1:new_namebez').nodeTypedValue; var ArtikelAnzahl = results[i].selectSingleNode('./q1:new_anzahl').nodeTypedValue; var ArtikelPreis = results[i].selectSingleNode('./q1:new_vkpreiseu').nodeTypedValue; var name = results[i].selectSingleNode('./q1:new_kalkulationid').nodeTypedValue; msg += ArtikelName +"\t"+ ArtikelAnzahl +"\t" + ArtikelPreis + "\n" + name +"\r"; } alert(msg); } }
Hi,
ok I have a very good response from the fetch xml. Thank you for your development.
And now I want to create the different quotedetail products with the result of the xml request. The Script should start with an Action Button in my navigation panel.
I don't know how I transfer the result of the fetch xml into my CRM SDK Webservices.Regards,
Andreas
- Marked as answer by Andreas_Mueller Wednesday, September 1, 2010 2:31 PM
Wednesday, September 1, 2010 12:26 PM -
Hi togehte,
I've found my solution. It's here:
var oppid = crmForm.all.opportunityid.DataValue[0].id; var quoteidvalue = crmForm.ObjectId; var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader()+ "<soap:Body>"+ "<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+ " xsi:type='q1:QueryExpression'>"+ "<q1:EntityName>new_kalkulation</q1:EntityName>"+ "<q1:ColumnSet xsi:type='q1:ColumnSet'>"+ "<q1:Attributes>"+ "<q1:Attribute>new_namebez</q1:Attribute>" + "<q1:Attribute>new_stdart</q1:Attribute>" + "<q1:Attribute>new_anzahl</q1:Attribute>" + "<q1:Attribute>new_vkpreiseu</q1:Attribute>" + "<q1:Attribute>new_kalkid</q1:Attribute>" + "<q1:Attribute>new_kalkulationid</q1:Attribute>" + "</q1:Attributes>"+ "</q1:ColumnSet>"+ "<q1:Distinct>false</q1:Distinct>"+ "<q1:Criteria>"+ "<q1:FilterOperator>And</q1:FilterOperator>"+ "<q1:Conditions>"+ "<q1:Condition>"+ "<q1:AttributeName>new_kalkid</q1:AttributeName>"+ "<q1:Operator>Like</q1:Operator>"+ "<q1:Values>"+ "<q1:Value xsi:type='xsd:string'>"+oppid+"</q1:Value>"+ "</q1:Values>"+ "</q1:Condition>"+ "</q1:Conditions>"+ "</q1:Criteria>"+ "</query>"+ "</RetrieveMultiple>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; //alert(resultXml); // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; //debugger; alert(msg); } // Parse and display the results. else { var results = resultXml.getElementsByTagName('BusinessEntity'); var msg = ""; if (results.length == 0) { msg = "No kalkulation Associated"; //debugger; alert(msg); return; } else { for (i=0;i < results.length;i++) { //debugger; var ArtikelName = results[i].selectSingleNode('./q1:new_namebez').nodeTypedValue; var ArtikelAnzahl = results[i].selectSingleNode('./q1:new_anzahl').nodeTypedValue; var ArtikelPreis = results[i].selectSingleNode('./q1:new_vkpreiseu').nodeTypedValue; var name = results[i].selectSingleNode('./q1:new_kalkulationid').nodeTypedValue; //debugger; msg += ArtikelName +"\t"+ ArtikelAnzahl +"\t" + ArtikelPreis + "\n" + name +"\r"; } //alert(msg); var zaehler = 0; for (i=0;i < results.length;i++) { //debugger; var ArtikelName = results[i].selectSingleNode('./q1:new_namebez').nodeTypedValue; var ArtikelAnzahl = results[i].selectSingleNode('./q1:new_anzahl').nodeTypedValue; var ArtikelPreis = results[i].selectSingleNode('./q1:new_vkpreiseu').nodeTypedValue; var name = results[i].selectSingleNode('./q1:new_kalkulationid').nodeTypedValue; var xml2 = "<?xml version='1.0' encoding='utf-8'?>" + "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+ " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ GenerateAuthenticationHeader()+ "<soap:Body>"+ "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<entity xsi:type='quotedetail'>"+ "<productdescription>"+ArtikelName+"</productdescription>"+ "<quantity>"+ArtikelAnzahl+"</quantity>"+ "<priceperunit>"+ArtikelPreis+"</priceperunit>"+ "<quoteid>"+quoteidvalue+"</quoteid>"+ "</entity>"+ "</Create>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq2 = new ActiveXObject("Msxml2.XMLHTTP"); xHReq2.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq2.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Create"); xHReq2.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq2.setRequestHeader("Content-Length", xml2.length); xHReq2.send(xml2); // Capture the result var resultXml2 = xHReq2.responseXML; // Check for errors. var errorCount = resultXml2.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml2.selectSingleNode('//description').nodeTypedValue; //alert(msg); } // Open new contact record if no errors. else { //alert('Anlegen eines Produktes erfolgreich'); } var erfolgmessage =""; zaehler= zaehler +1; } //alert(msg); alert('Es wurde(n) ' + zaehler + ' Produkt(e) dem Angebot hinzugefüt!'); } }
And now I link this with a button and erverything is fine. Can I also create manual products?
What's your oppinion?
This is the related post for the Create Soap: http://social.microsoft.com/Forums/en-US/crmgerman/thread/a02145bf-d618-4f0a-bb3c-df491009847b
Regards,Andreas
Wednesday, September 1, 2010 2:33 PM