Hi,
In this post will provide the code to check if concerned/given view exists in D365FO or not and for this purpose we are making use of SQLBuilderView class. Trying to check if the view by name Customer exists or not.
Note: CG_DoesViewExistsUsingSQLBuilder is a runnable class.
class CG_DoesViewExistsUsingSQLBuilder
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
SQLBuilderViewNavn viewId = viewstr(Customer);
boolean doesViewExists;
doesViewExists = SQLBuilderView::viewExist(viewId);
if (doesViewExists == true)
{
Info(strFmt("View %1 exists", viewId));
}
else
{
Info(strFmt("View %1 not exists", viewId));
}
}
}
Regards,
Chaitanya
*This post is locked for comments