Views:

Description

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

Signature

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

Example

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


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


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

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:

Comments (1)
  • Might help someone...

    Example here refers to GetLayoutXML which doesn't appear to be a valid function. I have simply saved my LayoutXML in a query with a different name, then called GetFetchXML against that.

    E.g.:
    AddCustomView('preferredsystemuserid', 'systemuser', 'Only users in Canada BU', GetFetchXML('CanadaUsers'), GetFetchXML('CanadaUsers-LayoutXML'), false)