How to use the parameters properties of form, including with types.
I am new for this so any suggestion or feedback please give an example with basis to advance level....
*This post is locked for comments
How to use the parameters properties of form, including with types.
I am new for this so any suggestion or feedback please give an example with basis to advance level....
*This post is locked for comments
You can pass parameters for opening the form using javascript like this:
var parameters = {param_0: "questions"};
//below code is for opening dialogue, you can change the target as you need.
Xrm.Navigation.navigateTo({
pageType: "entityrecord",
entityName: "contact",
entityId: contactid,
data: parameters
},
{
target: 2,
position: 1,
width: { value: 50, unit: "%" }
});
on the receiving form, you can use the code below to read the parameter's value.
Deprecated method:
var params = Xrm.Page.context.getQueryStringParameters();
New method:
var params = Xrm.Utility.getGlobalContext().getQueryStringParameters()
Sushil,
Just to add the things you need to know in real practice.
In practice this parameter purpose is similar to QueryString in web programming.
CRM by default for every form already have the internal parameters, if you notice in the CRM Form for existing record and new record will have different URL with different query string.
Example of new record you will have parameter for entity code, for existing record not only entity code, you also have the record id to identify it.
The CRM already have parameters passing method to make easy if you want to connect the CRM for external web for instance, you just want to open the right form so you just open the entity form.
Additional purpose, somehow are not only want to open a Form with the standard URL (record id, entity code, etc), you also want to set the default value.
Example: In your website if you want to make sure that the Account you entered was created from website and then you pass an address record and make sure that his type is primary, then you pass this parameter:
//Set the Address Type to “Primary”.
parameters["address1_addresstypecode"] = "3";
parameters["new_sourcefieldname"] = "Website"; //for example this is a text field type.
or another complete example explained in this article:
msdn.microsoft.com/.../gg334375.aspx
You can try using the direct URL:
/main.aspx?etn=account&extraqs=name%3DNew%20Account&pagetype=entityrecord
It will set the default value for new Account with name = "New Account"
See this identifier:
extraqs=name%3DNew%20Account
Once you open the URL or using script with those parameters, CRM will auto populate the default value for this New Account.
So by default CRM already have those parameter method accepted what if you want to process more? Example: You want to have a branch logic, if this from Web then you need to give category = e-form, if not then manual form.
So, you would need a special parameter to process next form logic then you accept this with the script registered onload.
That's the reason why you need to configure the parameters you shown in the screenshot.
Then you can write a script to pass additional param:
One is from sending, other one is for accepting.
See the example from my next links.
Then what's next?
You need to configure that the parameters are valid to be accepted, that's you need to configure the form properties --> Parameter, referring to your question and screenshot again.
If you didnt define, CRM cannot recognize this as valid accepted parameter, it is good for security in communication purpose.
See this sample will make you easier to understand:
mscrmmindfire.wordpress.com/.../crm-2013-passing-custom-parameters-to-openentityform-function
crmjavascripts.blogspot.com/.../pass-custom-parameter-with-query-string.html
community.dynamics.com/.../pass-custom-parameters-to-an-entity-form-through-a-url-in-crm-2013.aspx
Then, What's the type?
Different field type will have different accepted method of parameters, for example:
For Boolean fields, use either an integer value of 0 or 1, or a text value of true or false to set the value.
For DateTime fields, use the text value of the date.
You cannot give the datetime field with invalid format, example you give parameter = "today", it wont translate to today date, you need to define the exact valid date parameter.
Any attempt to pass an invalid parameter or value will result in an error.
That's why you need to configure properly the parameter data type.
Hope this can help you.
Thanks.
Hi Sushil,
By default CRM forms has specified set of Query String parameter defined, but if you want to pass your own Query String parameters, you can use the Form Properties-> Parameters to pass on values.
Below is the article which explains Parameters and it's usage in details with example
www.powerobjects.com/.../passing-parameters-between-forms-crm-2011
msdn.microsoft.com/.../gg334375.aspx
msdn.microsoft.com/.../gg334436.aspx
Hope that helps
Thanks
Please mark my post as verified if you found it helpful
André Arnaud de Cal... 291,391 Super User 2024 Season 2
Martin Dráb 230,445 Most Valuable Professional
nmaenpaa 101,156