Inline functions

This topic provides behavior and reference information for inline functions.

In any text input that supports inserting reference fields, an inline function can be entered that can be resolved to a value at runtime. For more information, see Insert reference fields.

A number of functions are provided out of the box. Functions can also be used as arguments for other functions.

Function behavior

The parsing engine replaces any inserted reference tokens first, and then the resulting text is evaluated for functions. If a function contains another function as an argument, the inner most function will be evaluated first. As reference tokens are replaced first, the reference token can also contain function syntax that will be evaluated. Functions cannot refer to named controls.

Function reference

And

Returns true if the first function and the second function returns true.

Usage

fn-And(greaterthan(value1,value2), lessthan(value3,value4))

Arguments

  • function1: A function which returns a boolean (true/false) value.
  • function2: A function which returns a boolean (true/false) value.

Contains

Returns true if the first argument contains (at the beginning, at the end, or anywhere within) the second argument.

Usage

fn-Contains(value1, value2)

Arguments

  • value1: A string value that might contain value2.
  • value2: A string value that might be contained in value1.

DoesMemberExistInAudience

Returns true if the current user belongs to the SharePoint audience.

Usage

fn-DoesMemberExistInAudience(SharePointAudience)

Argument

SharePoint Audience: The string value of the SharePoint audience to evaluate if the current user is a part of.

EndsWith

Returns true if the first argument ends with the second argument.

Usage

fn-EndsWith(value1, value2)

Arguments

  • value1: A string value that might end with value2.
  • value2: A string value that might be used at the end of value1.

Equals

Returns true if the second argument is equal to the first argument.

Usage

fn-Equals(value1, value2)

Arguments

  • value1: A string value that value2 is to be compared to.
  • value2: A string value to compare to value1.

GetQueryString

Returns the value for a specific key in the query string. This can be used to specify default values for the People and Single Line Textbox controls by including query string parameters in the URLs that opens the form in New mode.

If the key cannot be located in the query string, a blank value will be returned. If there is any potentially damaging JavaScript in the value, it will be removed before being inserted into the form or control settings.

Usage

fn-GetQueryString(key)

Arguments

key: a string that represents the parameter name passed to the form via the query string.

GreaterThan

Returns true if the second argument is greater than the first argument.

Usage

fn-GreaterThan(value1, value2)

Arguments

  • value1: An integer value that value2 might be greater than.
  • value2: An integer value that might be greater than value1.

GreaterThanOrEqual

Returns true if the second argument is greater than or equal to the first argument.

Usage

fn-GreaterThanOrEqual(value1, value2)

Arguments

  • value1: An integer value that value2 might be greater than or equal to.
  • value2: An integer value that might be greater than or equal to value1.

IsCurrentUser

Returns true if the current user is the same user specified in the string argument.

Usage

fn-IsCurrentUser (username)

Argument

username: The string value to evaluate if it matches the current username. The username includes the domain name. e.g. crestan\johndoe

IsDate

Returns true if the argument is a date.

Usage

fn-IsDate(value)

Argument

value: The string value to evaluate if it is in a date format.

IsMemberOfGroup

Returns true if the current user belongs to the Windows / SharePoint group specified in the string argument.

Usage

fn-IsMemberOfGroup(groupname)

Argument

groupname: The string value of the SharePoint group name to evaluate if the current user is a member of.

IsNullOrEmpty

Returns true if the argument is empty or null.

Usage

fn-IsNullOrEmpty(value)

Argument

value: The string value to evaluate if it's empty or null.

IsNumeric

Returns true if the argument is a number.

Usage

fn-IsNumeric(value)

Argument

value: The string value to evaluate if it is a number.

LessThan

Returns true if the second argument is less than the first argument.

Usage

fn-LessThan(value1, value2)

Arguments

  • value1: An integer value that value2 might be less than.
  • value2: An integer value that might be less than value1.

Returns true if the second argument is less than the first argument.

LessThanOrEqual

Returns true if the second argument is less than or equal to the first argument.

Usage

fn-LessThanOrEqual(value1, value2)

Arguments

  • value1: An integer value that value2 might be less than or equal to.
  • value2: An integer value that might be less than or equal to value1.

Returns true if the second argument is less than or equal to the first argument.

Not

Returns the reverse of the boolean value. If value is true, then the function returns false. If value is false, function will return true. Use when you want to make sure a value is not equal to one particular value.

Usage

fn-Not(bool value)

Argument

Bool value: A value that evaluates to either true or false.

Or

Returns true if either the first function or the second function returns true.

Usage

fn-Or(greaterthan(value1,value2), lessthan(value3,value4))

Arguments

  • function1: A function which returns a boolean (true/false) value.
  • function2: A function which returns a boolean (true/false) value.

StartsWith

Returns true if the first argument starts with the second argument.

Usage

fn-StartsWith(value1, value2)

Arguments

  • value1: A string value that might start with value2.
  • value2: A string value that might be used at the start of value1.

SubString

Extracts and returns a portion of text from a string.

Usage

fn-SubString(sourceString, startIndex, length)

Arguments

  • sourceString: The entire string.
  • startIndex: The starting character (1-based).
  • length: The number of characters to include.

Related information

Insert reference fields

Inline functions usage examples