CRM 2011 Get attributes from an entity using JavaScript -
i trying fill read-only field automatically using java script web resource. field dependant on lookup containing custom entity , free text field of 4 characters (first part of postcode example: nw10)
i have written javascript values , create new value set in read-only field. when run string displayed shows "[object-object]-nw10".
i guess i'm asking how access attributes of type object passed function? javascript below:
function typeaffectedorregionaffected_onchanged(executioncontext, type, region, weighting) { var type = xrm.page.data.entity.attributes.get(type).getvalue(); var region = xrm.page.data.entity.attributes.get(region).getvalue(); // if have values both fields if (type != null && region != null) { // create weighting variable var weighting = type.substring(4) + "-" + region; // recreate weighting value xrm.page.data.entity.attributes.get(weighting).setvalue(weighting); } }
type
lookup, need access name
property
var weighting = type[0].name.substring(4) + "-" + region;
Comments
Post a Comment