SharinPix Form Formula: Fields and Attributes

Overview

The SharinPix Form Formula Field allows you to dynamically reference and manipulate data. Using formulas, you can combine static values with live data coming from form inputs and other sources to create flexible, data-driven form templates.

This article covers the following:

Tips: 

Follow this documentation to learn more about the Functions and Operators available in a SharinPix Form Formula Field

Getting Started

Formulas can reference data from the following sources:

  1. Current Form Fields: Values entered by the end-user (e.g., elementAPIName).
  2. URL Parameters: Data passed when launching the form via the form.params. prefix (e.g., form.params.approval_threshold).

Accessing Form Fields

Any question with an API name can be used in a formula field. An API name can be added to a question using the API Name field on the form builder, as shown below.

The SerialNumber field can then be used in formula fields as shown above

A section or page cannot contain fields with the same API name.

Accessing nested fields

To access a nested field, i.e a field found inside a section, make sure to add an API name to the Section element as well. In the picture below the API name "Bedroom" is added to a Section element.

The "Bedroom" Section element contains a Radio question with the "ACWorking" API name as shown below.

To reference the "ACWorking" Radio question in a formula field found outside the "Bedroom" Section, it should be prefixed with the Section's API name as shown in the example below.

Tips: 

A field can be referenced without any prefix if it is being used in the same level (i.e, the section where it is found)

Accessing Attributes of Form Fields

A field can contain several attributes based on its type and they can be accessed by adding a "." following a field API name.

Generic Questions attributes

These attributes are available on almost all questions.

AttributePurpose
valueReturns the current value of the field
labelReturns the label of the question
noteReturns the current note added to the question if any
referenceReturn the previous value of the question in the context of a follow-up form
visibleReturns whether the question is currently visible or not (This is available to use only if the question has a visibility formula configured)

Section Attributes

These attributes are only available to sections.

AttributePurpose
_questionsCountReturns the number of visible questions that are inside the section
_questionsFilledCountReturns the number of visible questions that have filled inside the section
indexReturns the index of the section if it a repeated section

The API names of the questions inside the Section are also attributes of the Section.

If a Section is a Repeated Section, it will also have the index attribute, which returns its position in the Repeated element as shown below.

Repeated Sections attributes

These attributes are only available to the Repeated Sections element.

AttributePurpose
sizeReturns the number of sections added by the user

The nested fields of the repeated sections can also be referenced. Follow this documentation to learn more.

Global form attributes

There are several global attributes that can be accessed by using the form keyword

AttributePurpose
compareReturns true when the form being filled is a follow-up form.
paramsAllows accessing the url params found in the url that was used to load the form. Follow this documentation to learn more about this attribute.
responseReturns details of the SharinPix Form Response record. This can be used to show additional details on the SharinPix Form PDF.
templateReturns details of the SharinPix Form Template record.
viewReturns "print" in the context of pdf. This is useful for hiding or show specific fields on the SharinPix Form PDF.

response attribute

This attribute of the form global field contains nested attributes about a SharinPix Form Response record created by the form.

AttributePurpose
sfidThe Salesforce Record ID linked to the form response
sfnameThe Salesforce Record Name linked to the form response    

template attribute

This attribute of the form global field contains nested attributes about the SharinPix Form Template record.

AttributePurpose
sfidThe Form Template ID
sfnameThe Form Template Name

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.