My plug-in returns data to my javascript webresource. Through Mapping definitions, I update Text fields, Optionsets, Date fields etc from raw text,- no problem.
However, to set values in Lookups I need to know the guid of the record to select in order to create an object containing fieldname, guid and value before calling:
window.parent.Xrm.Page.getAttribute(fieldName).setValue(object);
Trouble is, I don't know the guid.
I'm thinking I could write an oData query to find the guid (is there another way?!), but I don't think I can, using the one key piece of data I have (e.g. the name) reliably/consistently build a query filter for any lookup's related entity I may encounter, as the field names will vary.
Before I go too far with experimentation, is this likely to be achievable?
I have a server-side D365 Process which obtains the mappings and returns these to the javascript so maybe I could do something there to find the guid?