web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

editableCRM Grid

(0) ShareShare
ReportReport
Posted on by 545

Hi All, 

I am using Editable Crm Grid in which my requirement is, on change of product unit, the unit value should appear in field. 

i wrote following script. 

function setPricePerUnitbase() {
var productId = null;
var Uomid = null;
var CurrencyId = null;
var editedrow = AbleBridge.DataGrid.GetEditRows()[0].RowIndex;
var rowIndex = AbleBridge.DataGrid.GetRowData()[editedrow];
var isfound = false;

try { productId = rowIndex.ProductId.Id } catch (ex) { productId = null; }
try { CurrencyId = rowIndex.TransactionCurrencyId.Id ; } catch (ex) { TransactionCurrencyId = null; }
try { Uomid = rowIndex.UoMId.Id; } catch (ex) { Uomid = null; }

//If existing product is selected then set productId to the GUID of existing product.
debugger;
if (productId !== null && Uomid != null) {
var req = new XMLHttpRequest();
var url = Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/ProductSet(guid'" + productId + "')?$select=product_price_levels/Amount,product_price_levels/TransactionCurrencyId,product_price_levels/UoMId&$expand=transactioncurrency_product,product_price_levels&$filter=transactioncurrency_product/ TransactionCurrencyId ne null ";
req.open("GET", url, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (req.readyState == 4) {
var data = JSON.parse(req.responseText);
var values = new Array();
values = data.d.product_price_levels.results;
debugger;
values.forEach(function (item, index) {
if (item.TransactionCurrencyId.Id == CurrencyId && item.UoMId.Id == Uomid) {
AbleBridge.DataGrid.SetFieldValue('PricePerUnit', item.Amount.Value, rowIndex);
isfound = true;
}
})
if (isfound == false) {
alert("The Unit Price Does Not Exist for this unit");
AbleBridge.DataGrid.SetFieldValue('PricePerUnit', null, rowIndex);
}

}
};
req.send(null);
}
};

the issue is, after changing the product unit from column, the row index is pulling same old record unit, not the new one which i selected. The same script works when i add new product, with rowindex as insert NewrowIndex

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans