Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

How to Update records of a Sub-grid in CRM 2013 using OData JSON JQuery

$
0
0

Hello,

Below is my Product sub grid on Quote Entity.

Now On addition of new product , I am calculating Service tax and tax based on Price per unit, quantity and discount.

Now i need to set calculated service tax and tax value in sub grid.


I want to Update record of a Sub-grid in Quote Entity. I have tried below code, but still not able to update my sub grid .

function OnRefresh() {  var gridControl = document.getElementById("quotedetailsGrid").control; var ids = gridControl.get_allRecordIds(); for (i = 0; i < ids.length; i++) { var quotedetail = new Object();

quotedetail.new_service_tax = "1000"; var id = ids[i].replace("{", "").replace("}", "");

QuoteProductRecord(id,quotedetail); } } function QuoteProductRecord(id,quotedetail) { var jsonEntity = window.JSON.stringify(quotedetail); var ODataPath = Xrm.Page.context.getServerUrl() + "/XrmServices/2011/OrganizationData.svc/QuoteDetailSet"; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", datatype: "json", data: jsonEntity, url: ODataPath + "(guid'" + id + "')", beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); XMLHttpRequest.setRequestHeader("X-HTTP-Method", "MERGE"); }, success: function (data, textStatus, XmlHttpRequest) { alert("Success"); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); }

Issue is that there is no error thrown, but still Service tax and tax value in sub grid is blank.

In JSON function, i have also tried to alert success message , but neither i got any success message nor any error message.


Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>