c# - Copy a text field data into a look field type -
i new in coding world :) helpful if can me below query.
have created 2 custom entity called sector , sub sector having 1:n relationship account. since relation fields hence lookup type , populated on account form. on part, have insideview( 3rd party tool) integrated our contact , account form. have mapped fields inside view crm fields update data inside view when being synced inside view not support lookup type field hence cannot map lookup field type data.
we discovered barrier when tried map our custom entity (sector , subsector) inside view. since cannot map lookup field type thought have 2 text field instead , map inside view. once data synced these 2 text fields filled out sector , subsector name.
now, want copy information text fields lookup field (custom fields sector , sub sector) in advance :) bhavesh
i not understanding requirement can fill lookup field text.
use following code:
function setlookupfield() { var context = xrm.page.context; var userid = context.getuserid();// id var username=context.getusername();//your text var lookupdata = new array(); var lookupitem = new object()`enter code here`; //set guid lookupitem.id = userid; //set name lookupitem.name = username; lookupitem.entitytype = "systemuser";// entity name of lookup lookupdata[0] = lookupitem; //if existing value empty, set new value var existingvalue = xrm.page.getattribute("new_usercreatedby").getvalue(); if (existingvalue === null) { xrm.page.getattribute("new_usercreatedby").setvalue([{ id: userid, name: username, entitytype: "systemuser" }]); } else { return; } }
Comments
Post a Comment