How Can We Help?

Search for answers or browse about Sintel Forms.

Using query string parameters for default/calculated values

You are here:

When dealing with default or calculated values in a form you can now use the new queryParam() function to set these values directly from the URL address that the users are using to open up a form.

In order to use this feature, following steps must be taken:

  1. queryParam() formula needs to be used in default/calculated value definition
  2. proper URL needs to be set up

Using the queryParam() function

The function needs to be simply typed in the default formula or the calculated formula fields on a field. See more details in related articles (default values, calculated values).

Syntax of the function is: queryParam(<name_of_query_parameter>), e.g. queryParam(“parameterOne”).

As default/calculated values mechanism expects a javascript expression, it is possible to combine usage of queryParam function call with using a fallback value. Example:

queryParam(“parameterName”) ? queryParam(“parameterName”) : “A default value”

The above formula will try to use the value of “form_parameterName” parameter present in the URL. If it can’t be found, the “A default value” text will be used instead.

Setting up the URL

Values returned by the queryParam() function are retrieved from the URL that has been used to open up a form in Sintel Forms. Therefore you need to extend the URL with proper key-value pairs by appending following text to it:

?form_<parameterName>=<value>
Note that the name of parameter needs to be prefixed with a “form_” text.

URL parameter examples

Text field value for "defaultTitle" parameter:

&form_defaultTitle=This is a default query parameter

Number field value for "defaultNumber" parameter:

&form_defaultNumber=12.34

Choice field value for "defaultChoice" parameter: 

&form_defaultChoice=Choice One

Multi choice field value for "defaultMultiChoice" parameter (comma separated values are used):

&form_defaultMultiChoice=Choice One,Choice Two

Lookup field value for "defaultLookup" parameter (the id of lookup item is provided):

&form_defaultLookup=1

User field value for "defaultUser" parameter (the email of a user is provided):

&form_defaultUser=user@domain.com

Combining URL parameters:

&form_parameter1=user@domain.com&form_parameter2=A value&form_parameter3=123

URL parameters need to be appended to an URL that points to list item creation/edition page.

For anonymous forms, you can use the anonymous access link that can be copied from Forms Designer.

For regular forms, you can use the default SharePoint list item URLs. For instance, an example link for adding a new item to the list is:

https://yourcompany.sharepoint.com/sites/nameOfTheSite/Lists/nameOfTheList/NewForm.aspx

After you add query parameters to this, it will look as follows:

https://yourcompany.sharepoint.com/sites/nameOfTheSite/Lists/nameOfTheList/NewForm.aspx?form_parameterOne=1&form_parameterTwo=A default value

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents