Hi,
In my Service Appointment ,
I have two fields which are look up and I want to reset to certain lookup types only - not all entity types present in the system.
Entity : Service Appointment
One field is regardingobjectid
Data type : look up
Want this lookup restrict to only : Incident (Case)
Another is customers
Data type : Party list
want this list to have contact lookup records only.
I tried to manipulate these fields using JavaScript on Form load
Various Methods used in Code :
Method 1
var control1= Xrm.Page.getControl("regardingobjectid");
control1getAttribute().setLookupTypes(["incident"]);
var control2 = Xrm.Page.getControl("customers");
control.getAttribute().setLookupTypes(["contact"]);
Still I'm able to access other entities records in these fields
Method 2 :
var lookupData = Xrm.Page.getAttribute('regardingobjectid').getLookupDataAttribute();
if (lookupData.getSupportedLookupTypes().length > 1
&& lookupData.getSingleLookupTypeId() !== 112) {
lookupData.setLookupTypes(['incident']);
}
Here I'm getting error : Xrm.Page.getAttribute(....).getLookupDataAttribute(); is not defined
Method 3 :
Using DOM elements , it will not work in current version - CRM Dynamics 365
http://mscrmgoodies.blogspot.com/2012/02/custom-lookup-in-crm-2011.html
I don't know why its not working in that entity where I tried method 1 which is working in Case entity with similar kind of fields. Can anyone help me in this problem ?
References (I used till now):
https://community.dynamics.com/crm/f/117/t/186304
https://missdynamicscrm.blogspot.dk/2014/06/crm-20112013-filter-look-for-lookup-activity-party.html
https://dreamingincrm.com/2016/06/02/restricting-the-customer-lookup/
https://community.dynamics.com/crm/f/117/p/218302/582721#582721
Best,
Deepthi
*This post is locked for comments