Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Set custom view as default for lookup in Business Process Flow via JavaScript (Unified Interface)

$
0
0

Hey guys,

I am currently working on a requirement regarding the Business Process Flow in the new Unified Interface.
I need to add a custom view I create with JavaScript to a lookup field in the BPF.

So in JS, I create a custom FetchXML for the filtering and also create custom FetchXML for the layout.
Once I got both get the control via the formContext and add the custom view.
So far so good: The view is added to the list of views when I click on "Change View" on the lookup in the BPF.
But unfortunately it is not applied by default, so a user wouldn't need to click on "Change View".

I have tried to use the "setDefaultView" function right after I add the custom view but unfortunately that does not work.
It worked a couple of weeks ago actually only by using the "addCustomView" function but now it does not set it to default anymore.

Does anyone experience the same issue or came across something familiar?

Here is my code:

//Create FetchXML and GridXML for CustomView in BPF
 var consultantFetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
        "<entity name='systemuser'>"+
          "<attribute name='fullname' />"+
          "<attribute name='systemuserid' />"+
          "<order attribute='fullname' descending='false' />"+
          "<link-entity name='teammembership' from='systemuserid' to='systemuserid' visible='false' intersect='true'>"+
            "<link-entity name='team' from='teamid' to='teamid' alias='ad'>"+
              "<filter type='and'>"+
                "<condition attribute='teamid' operator='eq' uiname='Consulting' uitype='team' value='{269FDEA7-EAF0-E911-A812-000D3AB958AA}' />"+
              "</filter>"+
            "</link-entity>"+
          "</link-entity>"+
        "</entity>"+
      "</fetch>";
//Create custom FetchXML for the layout
 var consultantLayout = "<grid name='resultset' jump='fullname' select='1' icon='1' preview='1'>"+
                   "<row name='result' id='systemuserid'>"+
                     "<cell name='fullname' width='300' />"+
                   "</row>"+
                 "</grid>";
//Add the custom view to the control
 formContext.getControl("header_process_new_consultant").addCustomView("{00000000-0000-0000-0000-000000000002}", "systemuser", "Consultant View", consultantFetch, consultantLayout, true);
//Try to set the view default
 form.getControl("header_process_new_consultant").setDefaultView("{00000000-0000-0000-0000-000000000002}");

Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>