Hi,
I have to use Javascript to set dynamically the value of the currency field, but I cannot achieve it.
Generally I was trying to achieve it by below solutions:
1) Xrm.Page.data.entity.attributes.get(“currencyfield”).setValue(1000);
2)var field = executionContext.getFormContext().getAttribute("currencyfield");
field.setValue(145000034);
3)
var lookup = new Array();
lookup.type = "Microsoft.Crm.Sdk.Data.Service.Money";
lookup.value = 1000;
Xrm.Page.getAttribute("currencyfield").setValue(lookup);
Unfortunately any of these above solutions doesn't set the value of Field with type "Currency".
Do you have any idea what I'm doing wrong or what should I do set dynamically Currency field?
the "Currency Name" that you defined in currencies (Settings > Business Management > Currencies)
What name are we supposed to put for "put here your currency name" ?
Hi
I had same problem and i searched too many sites and i've tried all solutions
but finally by debbuging i find this solution:
befor set field value, write this line of code:
(Xrm.Page.getAttribute("your field name")).$2_2.$CK_1.Data_23 = "put here your currency name";
then set value:
Xrm.Page.getAttribute("your field name").setValue(1000);
Look at the first solution, which I have tried:
It's the same what you've mentioned.
I have placed this function on change another field, and the function looks like this:
function SetDiscountValue()
{
Xrm.Page.data.entity.attributes.get(“manualdiscountamount”).setValue(1000);
}
When I change the value of one field, it invokes this function, but it returns:
Xrm.Page.data.entity.attributes.get(“Currency field name”).setValue(1000);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156