Fallen Posted May 20, 2014 Share Posted May 20, 2014 (edited) Hello! im so new to javascript, my situation is beginner of the beginner But i have to write a code on mscrm 2011 order entity. i have two field, pricelevelid and new_taxincl(radio button). I want to change value in pricelevelid field based on selection of new_taxincl field. If user select ''yes'' i want to fill pricelevelid field with ''USD -Tax Included-'', ''no'' ''USD -without tax-''. This have to run onChange event. I could not write the correct code so far. Any help will be fine for me. Thanks. Edited May 20, 2014 by Fallen Link to comment Share on other sites More sharing options...
Ingolme Posted May 20, 2014 Share Posted May 20, 2014 What code did you try? You can edit the value shown in a text input using the value property. Link to comment Share on other sites More sharing options...
Fallen Posted May 20, 2014 Author Share Posted May 20, 2014 What code did you try? You can edit the value shown in a text input using the value property. Hi Ingolme, Here is my code : function callRetrievePList() { var field = Xrm.Page.data.entity.attributes.get("new_taxincl"); if ((field == null) || (field.getValue() == null) || (field.getValue()[0] == null) || (field.getValue()[0].id == null)) return; var plistfield = Xrm.Page.data.entity.attributes.get("pricelevelid"); if (plistfield != null && plistfield.getValue() != null) return; var options = "$select=PriceLevelId,Name&$filter=new_vergidahil/Id eq (guid'" + (field.getValue()[0]).id + "')"; SDK.REST.retrieveMultipleRecords("PriceLevel", options, retrievePListCallBack, errorCallBack, completeCallBack);}function retrievePListCallBack(retrievedStock) { var kdvgost = Xrm.Page.data.entity.attributes.get("new_taxincl"); var deger = kdvgost.getValue(); if (deger == "0") { var plistfield = Xrm.Page.data.entity.attributes.get("pricelevelid"); if (plistfield != null && plistfield.getValue() != null) return; for (var i = 0; i < retrievedStock.length; i++) { var stock = retrievedStock[i]; var lookupReference = []; lookupReference[0] = {}; lookupReference[0].id = stock.PriceLevelId; lookupReference[0].entityType = "pricelevel"; lookupReference[0].name = stock.Name; plistfield.setValue(lookupReference); } }}function errorCallBack(errorObject) {}function completeCallBack() {} Link to comment Share on other sites More sharing options...
Fallen Posted May 21, 2014 Author Share Posted May 21, 2014 I still need help Link to comment Share on other sites More sharing options...
Ingolme Posted May 21, 2014 Share Posted May 21, 2014 I can't extract any information necessary for this task from your current code. Surely you have an HTML <input> element somewhere on your page with name="pricelevelid" You have two radio buttons with "yes" and "no" next to them. You need to access these elements using DOM methods, such as getElementById(), getElementsByTagName(), childNodes, parentNode, nextSibling, previousSibling... Then you change the value property as shown in this W3Schools page and set it to "USD - Tax Included -" or "USD - Without tax -" based on which radio button was selected. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now