Views:

Description

Provides the ability to add a custom view to a lookup control.

Signature

AddCustomView(
  'controlname', 
  'entitylogicalname', 
  'nameofview', 
  'fetchxml', 
  'layoutxml',
  'isdefault',
  'viewid'
)

Example 1

AddCustomView(
  'preferredsystemuserid', 
  'systemuser', 
  'Only users in Canada BU',
  GetFetchXML('CanadaUsers'), 
  GetLayoutXML('CanadaUsers'), 
  false
)

Example 2

AddCustomView(
  'primarycontactid',
  'contact',
  'Only contacts with names starting with A', 
  GetFetchXML('A-Contacts'),
  GetLayoutXML('A-Contacts'), 
  true, 
  '{00000000-0000-0000-0000-000000000001}'
)

Example 3

MultipleClientside(

  AddCustomView(
    'parentaccountid', 
    'account', 
    'Only accounts with names starting with A', 
    GetFetchXML('A-Accounts'), 
    GetLayoutXML('A-Accounts'), 
    true,
    '{00000000-0000-0000-0000-000000000001}'
  )

  AddCustomView(
    'primarycontactid',
    'contact',
    'Only contacts with names starting with A',
    GetFetchXML('A-Contacts'),
    GetLayoutXML('A-Contacts'),
    true, 
    '{00000000-0000-0000-0000-000000000002}'
  )
)

Parameters

Name Type Description Required
controlname xxxx xxxx xxxx
entitylogicalname xxxx xxxx xxxx
nameofview xxxx xxxx xxxx
FetchXml xxxx xxxx xxxx
LayoutXml xxxx xxxx xxxx
isDefault xxxx xxxx xxxx

Notes

In Dynamics 365 v9 there is a bug that Microsoft does not respect the isdefault flag. So in this case you need to set a viewid guid at the end of the function call.

Microsoft APIs

This North52 function relates to the following Microsoft APIs: