Asked by:
Unable to access the inline lookup in crm 2016

Question
-
Hi,
I am trying to access the inline lookup for an N:N subgrid. The thing is the code to filter the N:N subgrid that was working in CRM 2011 is not working anymore after we upgraded. So, we tried to disable the inline lookup with code below. But the code broke at document.getElement and the Watch on line 1 showed 'undefined'. We tried window.parent.document.getElementById too but that gave the same error. Is there any way to get this working?
var inlineBehaviour = document.getElementById('lookup_Policies_Affected_i').InlinePresenceLookupUIBehavior;
inlineBehaviour.setDefaultView('1DFB2B35-B07C-44D1-868D-258DEEAB88E2');
inlineBehaviour.set_disableInlineLookup(true);
Regards,
Anwesha
Saturday, February 6, 2016 1:00 PM
All replies
-
Hi Anwesha,
This is not the supported way to customize the lookup.
Things which might be working in CRM 2011 may not work with the CRM 2016 or higher version.
Please go for the Supported way to customize .
Regards,
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in
Monday, February 8, 2016 11:03 AM -
Hi Yusuf,
Many thanks for your response.
I am still struggling to find the supported way to create a custom view for the new inline look up for my N:N sub-grid. Do you have any idea how I can do this?
Please let me know.
Regards,
Anwesha
Monday, February 8, 2016 6:48 PM -
Hi Anwesha,
Did you find any solution for this? We have the same problem in CRM 2016...
Thanks,
Daniel.
Sunday, February 14, 2016 8:16 AM -
Hello Mohammad,
I know that the upper solution is not supported. Did you know supported way to filter lookup (N:N) inside subgrid .
thanks,
Daniel
Sunday, February 14, 2016 8:20 AM -
Hi Daniel,
Not yet. I am still looking for a solution for it. Let me know if you happen to find one.
Regards,
Anwesha
Sunday, February 14, 2016 8:36 PM -
Hi,
Microsoft has changed the client side rending engine with the intoduction of turbo forms (Microsoft Dynamics CRM Online 2015 Update 1 (v7.1) .
Please check this blog
http://blogs.msdn.com/b/crm/archive/2015/04/29/microsoft-dynamics-crm-online-2015-update-1-new-form-rendering-engine.aspx
try to get the element with like below JS.var objSubGrid = window.parent.document.getElementById("subgrid_opportunity");
Hope this helps.
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in
- Edited by Mohammad Yusuf Ansari Monday, February 15, 2016 7:37 AM
Monday, February 15, 2016 7:36 AM -
You can try below code
add this on form load
function
filterSubGrid() {
varworkflowTemplatetValue = Xrm.Page.getAttribute("_workflowtemplateid").getValue(); //field to filter by
varworkflowTemplatetGrid = document.getElementById("WorkflowTemplateSteps"); //grid to filter
if(workflowTemplatetGrid == null) { //make sure the grid has loaded
setTimeout(
function() { filterSubGrid(); }, 2000); //if the grid hasn’t loaded run this again when it has
return;
}
varworkflowTemplatetValueid = "00000000-0000-0000-0000-000000000000"; //if filter field is null display nothing
if(workflowTemplatetValue != null) {
workflowTemplatetValueid = workflowTemplatetValue[0].id;
}
//fetch xml code which will retrieve all the accounts related to the contact
varfetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
" <entity name='_workflowtemplatestep'>"+
" <attribute name='name' />"+
" <attribute name='code'/>"+
" <attribute name=workflowtemplatestepid' />"+
" <order attribute='code' descending='false' />"+
" <filter type='and'>"+
" <condition attribute='statecode' operator='eq' value='0' />"+
" <condition attribute='workflowtemplateid' operator='eq' value='"+ workflowTemplatetValueid + "' />"+
" </filter>"+
" </entity>"+
"</fetch>";
workflowTemplatetGrid.control.SetParameter(
"fetchXml", fetchXml); //set the fetch xml to the sub grid
workflowTemplatetGrid.control.refresh();
//refresh the sub grid using the new fetch xml
}
Hope this helps. ----------------------------------------------------------------------- Santosh Bhagat If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"
- Proposed as answer by Mr. Santosh Bhagat Monday, February 15, 2016 11:12 AM
Monday, February 15, 2016 11:12 AM -
Hi Santosh,
I tried this script but the code fails at subgrid.control and says null.
Let me know what else can be done.
Regards,
Anwesha
Thursday, February 18, 2016 7:45 PM