How to Check if the Current Form is a Quick Create Form in Dynamics 365 using JavaScript

 In Dynamics 365, you might need to identify whether the current form is a Quick Create form or another type, such as a Main form. 

You can do this by using

  executionContext.getContext().getQueryStringParameters().pageType

Here’s a quick JavaScript snippet to check if the form is a Quick Create form:


function isQuickCreateForm(executionContext)
{
    var formContext = executionContext.getFormContext();
    var pageType = formContext.context.getQueryStringParameters().pageType;

    if (pageType === 'quickcreate')
    {
        console.log("This is a Quick Create form.");
        return true;
    }
    else
    {
        console.log("This is not a Quick Create form.");
        return false;
    }
}


Usage:

  • For a Quick Create form, it will return 'quickcreate'
     

  • For other forms (like the Main form), it will return 'entityrecord'




This function allows you to easily check if the current form is a Quick Create form and apply specific logic as needed!


No comments:

Post a Comment