Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Unable to pass data via Query String

Posted on by 308

Hi all,

I have taken a simple scenerio, i have written a script that opens a new Entity Form from existing entity form. we all know the method  "openEntityForm" to open any existing or new entity form. I have written a following code registered on Lead Entity and it will open Account: 

function test(executionContext)
{
var context = executionContext.getFormContext();
var jobtitle = context.getAttribute("jobtitle").getValue();
var subject = context.getAttribute("subject").getValue();

var parameters={};
parameters["jobtitle"] = jobtitle;
parameters["subject"] = subject;

Xrm.Utility.openEntityForm("account",null,parameters);
}

but when this script executes it shows the following error

5488.error.JPG

Unhandled exception:
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: CRM Parameter Filter - Invalid parameter 'jobtitle=Manager' in Request.QueryString on page /form/Data.aspx
The raw request was 'GET /form/Data.aspx?_CreateFromId=&_CreateFromType=&counter=1554732116452&etc=1&extraqs=%3fetc%3d1%26jobtitle%3dManager%26process%3d%26subject%3dNew%2520business2&formid=8448b78f-8f42-454e-8e2a-f8196b0419af&jobtitle=Manager&oid=&pagemode=iframe&pagetype=entityrecord&process=&subject=New%20business2' called from fiber7.crm.dynamics.com/main.aspx.
at Microsoft.Crm.Application.ParameterFilter.ValidateParameter(HttpRequest request, ArrayList parameterCollection, String key, String value, ParameterSources source, EntityType pageEntityType, FormAdditionalAllowedParameters additionalAllowedParameters)
at Microsoft.Crm.Application.ParameterFilter.ValidateParameters(Page page, EntityType pageEntityType, Boolean alwaysEnableParameterChecking, FormAdditionalAllowedParameters formAdditionalAllowedParametersTemp)
at Microsoft.Crm.Application.Controls.AppPage.ValidatePageParameters()
at Microsoft.Crm.Application.Controls.AppPage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #88B8CCA9Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>f8558c98-a67f-47fc-81c7-ed67a965fad4</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---&gt; System.InvalidOperationException: CRM Parameter Filter - Invalid parameter 'jobtitle=Manager' in Request.QueryString on page /form/Data.aspx
The raw request was 'GET /form/Data.aspx?_CreateFromId=&amp;_CreateFromType=&amp;counter=1554732116452&amp;etc=1&amp;extraqs=%3fetc%3d1%26jobtitle%3dManager%26process%3d%26subject%3dNew%2520business2&amp;formid=8448b78f-8f42-454e-8e2a-f8196b0419af&amp;jobtitle=Manager&amp;oid=&amp;pagemode=iframe&amp;pagetype=entityrecord&amp;process=&amp;subject=New%20business2' called from fiber7.crm.dynamics.com/main.aspx.
at Microsoft.Crm.Application.ParameterFilter.ValidateParameter(HttpRequest request, ArrayList parameterCollection, String key, String value, ParameterSources source, EntityType pageEntityType, FormAdditionalAllowedParameters additionalAllowedParameters)
at Microsoft.Crm.Application.ParameterFilter.ValidateParameters(Page page, EntityType pageEntityType, Boolean alwaysEnableParameterChecking, FormAdditionalAllowedParameters formAdditionalAllowedParametersTemp)
at Microsoft.Crm.Application.Controls.AppPage.ValidatePageParameters()
at Microsoft.Crm.Application.Controls.AppPage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #88B8CCA9</Message>
<Timestamp>2019-04-08T14:01:56.7382882Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>f8558c98-a67f-47fc-81c7-ed67a965fad4</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d3p1="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>System.InvalidOperationException: CRM Parameter Filter - Invalid parameter 'jobtitle=Manager' in Request.QueryString on page /form/Data.aspx
The raw request was 'GET /form/Data.aspx?_CreateFromId=&amp;_CreateFromType=&amp;counter=1554732116452&amp;etc=1&amp;extraqs=%3fetc%3d1%26jobtitle%3dManager%26process%3d%26subject%3dNew%2520business2&amp;formid=8448b78f-8f42-454e-8e2a-f8196b0419af&amp;jobtitle=Manager&amp;oid=&amp;pagemode=iframe&amp;pagetype=entityrecord&amp;process=&amp;subject=New%20business2' called from fiber7.crm.dynamics.com/main.aspx.
at Microsoft.Crm.Application.ParameterFilter.ValidateParameter(HttpRequest request, ArrayList parameterCollection, String key, String value, ParameterSources source, EntityType pageEntityType, FormAdditionalAllowedParameters additionalAllowedParameters)
at Microsoft.Crm.Application.ParameterFilter.ValidateParameters(Page page, EntityType pageEntityType, Boolean alwaysEnableParameterChecking, FormAdditionalAllowedParameters formAdditionalAllowedParametersTemp)
at Microsoft.Crm.Application.Controls.AppPage.ValidatePageParameters()
at Microsoft.Crm.Application.Controls.AppPage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #8B78329C</Message>
<Timestamp>2019-04-08T14:01:56.7382882Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>

*This post is locked for comments

  • Suggested answer
    Ishan Sharma Profile Picture
    Ishan Sharma 308 on at
    RE: Unable to pass data via Query String

    Thanks to all, My script is working now, Actually i was not taking the correct Target Entity fields logical name in script.

    For example the current Entity is Lead and the Target Entity that will be opened  is Account, so i have to take Account's field logical name in My script

    var parameters = {};

    parameters["new_name"] = "ABCD";

    Xrm.Utility.openEntityForm("account", null, parameters);

    here Field with Logical name as "new_name"  must be present in Target entity that we want to open on any event from current entity. 

    In my scenario the current entity is Lead and Target Entity is Account 

  • Suggested answer
    crm development Profile Picture
    crm development 870 on at
    RE: Unable to pass data via Query String

    Hi Ishan,

    Try below code. Xrm.Utility.openEntityForm is being deprecated so may face issue.  Thanks.

    function test(executionContext)

    {

    var context = executionContext.getFormContext();

    var jobtitle = context.getAttribute("jobtitle").getValue();

    var subject = context.getAttribute("subject").getValue();

    var entityFormOptions = {};

    entityFormOptions["entityName"] = "account";

    var parameters={};

    parameters["jobtitle"] = jobtitle;

    parameters["subject"] = subject;

    // Open the form.

    Xrm.Navigation.openForm(entityFormOptions, parameters).then(

       function (success) {

           console.log(success);

       },

       function (error) {

           console.log(error);

       });

    }

  • Ishan Sharma Profile Picture
    Ishan Sharma 308 on at
    RE: Unable to pass data via Query String

    Hi All,

    I tried a lot but still my script is now working. below is my very simple code

    function test(executionContext)
    {
    debugger;
    var context = executionContext.getFormContext();
    var parameters = {};
    parameters["qryParam_safestring"] = "Test";
    Xrm.Utility.openEntityForm("account", null, parameters);
    }

    2677.Capture.JPG

    My script triggers at OnSave event of Lead and it should open a Account. It is working fine if don't  pass parameter in openEntityForm method

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Unable to pass data via Query String

    Hi Ishan,

    The parameter you are passing which should be either field name (Field should be available in the form) or custom parameter  (which you need to defined in the form properties) . If  you are passing field name then I think the field name you are passing is wrong , should be with publisher name. Also make sure the value assignment of any parameter also depends on field type. see here  -

    https://community.dynamics.com/crm/b/mscrmcustomization/archive/2016/10/25/xrm-utility-functions-openentityform

    Below sample code is working form me , see the field name available in the account form. 

    function test(executionContext) {
        var parameters = {};
        parameters["telephone1"] = "test title";
        parameters["websiteurl"] = "http://test.com";  
        //parameters["jobtitle"] = "test";
        //parameters["subject"] = "GDSS";
        var windowOptions = {
            openInNewWindow: true
        };
        Xrm.Utility.openEntityForm("account", null, parameters, windowOptions);
    }



    If you are passing custom parameter make sure you have create parameter. For more info see here  - 

    https://community.dynamics.com/crm/b/mscrmcustomization/archive/2016/10/27/get-set-query-string-parameters-to-crm-form

    formparameter.png

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Unable to pass data via Query String

    This is deliberate. CRM blocks unexpected querystring parameters. You can pass additional parameters as part of the extraqs parameter, which will also populate fields with that name, if that is what you're using the parameter for.

    If you have CRM OnPremise, you can disable the parameter filtering adding a DWORD registry value HKEY_Local_Machine\Software\Microsoft\MSCRM\DisableParameterFilter = 1

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans