Hi there,
How can i retrieve the OptionSet Value/text from my A entity to my B entity, the fields are not global OptionSet, are just independent but the values and the text values are the same, i cannot use frameworks, just need to use JS to achieve that.
My scenario is need to set the value from accounts to leads when i select the parentaccountid field on lead i try with this method, but returns me undefined or object...
function GetDataOnChange(){ var account = Xrm.Page.getAttribute("parentaccountid").getValue(); if (account){ var AccountInfo = oData.Retriever("Account", null, "OptionSetFieldValue/TextToRetrieve", "AccountId eq (guid'" + account[0].id + "')", false, null, null, null); if(AccountInfo != null && AccountInfo != undefined){ //if(AccountInfo != null && AccountInfo[0].OptionSetFieldValue/TextToRetrieve.value/text != undefined){ var MyFieldToRetrieve = new Array(); MyFieldToRetrieve[0] = new Object(); MyFieldToRetrieve[0].text = AccountInfo[0].OptionSetFieldValue/TextToRetrieve.text; Employees[0].name = AccountInfo[0].OptionSetFieldValue/TextToRetrieve.value; //Tried with this options all retrieve undefined or object object Xrm.Page.getAttribute(MyLeadOptionSetFieldToUpdateWithRetrievedData).setValue(MyFieldToRetrieve); Xrm.Page.getAttribute(MyLeadOptionSetFieldToUpdateWithRetrievedData).setValue(MyFieldToRetrieve.text); Xrm.Page.getAttribute(MyLeadOptionSetFieldToUpdateWithRetrievedData).setValue(MyFieldToRetrieve.value); } } } }
Thanks in advance for any help/clue!
Best wishes.
*This post is locked for comments