Hi all,
I'm beginner in CRM dynamic, i need to retrieve value from a column field which inside a record and the record is been call from lookup field.
Anyone there might have idea how to do it ?
Thank for the help!
*This post is locked for comments
Hi,
try these:-
var Id = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].id;
var Name = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].name;
or Can Use if not work(Use window.parent. before Xrm)
var Id = window.parent.Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].id;
var rName = window.parent.Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].name;
Hi,
You can use Odata query to get data you want. i attach URL link below so that you can have some example or knowledge about the query.
Cheers,
Will this help me retrieve any field within that lookup record?
I want to run a script on load of a form that checks the value of a custom field of the related lookup record.
Xrm.Page.ui.quickForms.get here I'm getting error and Xrm.Page.ui.quickForms as null even I have placed QuickViewform on Form. and used msdn.microsoft.com/.../mt736908.aspx Also. I registered my javascript method on change of lookup and tried with onload too.
Thanks in Advance.
Hi,
this might be most toward my question with example, thank for the help, but the fetch xml seem a little bit complicated for me as a beginner to understand. so i might using SDK.REST.retrieveRecord function to get value i needed.
You can create and add a quick view on your form. Access data of quick view form using JS method Xrm.Page.ui.quickForms.get("<QuickViewControlName>");
Hi,
1) Use Xrm.Page.getAttribute("FieldName").getValue(); to get lookup value, Extract ID from the object returned.
2) http://www.inogic.com/blog/2015/12/execute-fetchxml-using-web-api-in-dynamics-crm-2016/
Call fetchxml(get from Advanced Find) using above or similar approach, to fetch that record you are looking for, pass ID extracted from above step, you'll get a single record, which would contain whatever data you require(mentioned in fetchXML)
You want to get from JavaScript within the form?
lookupFieldObject = Xrm.Page.data.entity.attributes.get('entityid');
if (lookupFieldObject.getValue() != null) {
entityId = lookupFieldObject.getValue()[0].id;
entityName = lookupFieldObject.getValue()[0].entityType;
entityLabel = lookupFieldObject.getValue()[0].name;
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156