Using Custom Bigin Variables
The Custom Properties of the developer console allows you to create Bigin Variables that are helpful in a variety of situations depending on your business requirements.
Bigin Variables are pseudo-module fields that store static and reusable data in your Bigin account. You can use Bigin Variables in email templates, and they can also be utilized as reusable authentication parameters in custom functions, APIs, webhooks, custom links and buttons.
The Custom Properties section allows you to do the following:
- Create a new Bigin variable
- Set up a custom function for the Bigin variable
- Manage the Bigin variables
Only users with administrative privileges can create and manage the Bigin variables.
Create a new Bigin variable
To create a new Bigin variable, follow these steps:
- In your developer console, navigate to the Custom Properties section.
- Click the Create your first Bigin variable button. However, if you have already created a variable, then to create a new variable, click the Create New Variable button.
- On the Create Bigin Variable page, do the following:
- In the Variable Name field, type a name for the Bigin variable.
- In the API Name field, type a name for API.
- In the Description field, type a description for the Bigin variable.
- From the Variable Type drop-down list, select Single Line, which is a default value.
- For the Variable Status drop-down list, select a status for the Bigin variable.
- In the Value field, type an initial value for the Bigin variable.
- Click Save.
The Bigin variable uses the Single Line data type by default. The Single Line data type offers one line that displays information to the user or lets the user provide information in the form of text, numbers, or special characters.
Also, the Bigin variable is associated with a variable status that defines the usage of the variable and restricts the users from accessing it. While creating a new Bigin variable, you can assign one of the following variable statuses depending on your business needs:
- Read Only - Users are not allowed to change the values of the Bigin variables with Read Only status. The Read Only variables display information exclusively.
- Hidden - These variables are abstracted from the user but can change the functionality of a feature as needed.
Set up a custom function for the Bigin variable
After you create a new Bigin variable, you can now set up a custom function. When a user or system edits the value of the variable, the custom function is invoked to update the value of the variable.
You can configure custom function for only Hidden and Read Only variables.
To configure the custom function, from the list of Bigin Variables, under Field Value - On Change, click the Write Script link for the Bigin variable you want to customize. The Deluge Script editor appears.
In the custom function, you can use variableMap to obtain old and new values of the custom variable. The syntax for obtaining old and new values of the custom variable using variableMap looks as shown below:
To get the old value, use the following:
<oldvalue> = input.variableMap.get("oldvalue");
To get the new value, use the following:
<newvalue> = input.variableMap.get("newvalue");
Manage Bigin Variables
After setting up a custom function for a Bigin variable, you can also further manage the list of Bigin variables directly from the Custom Properties section. You can update the variable and its associated custom function as needed, moreover, you can remove the variable if not required.
On the Bigin Variable page, from the list of Bigin variables, hover over the variable you want to update, and then next to Variable Name, click the Pencil icon. When the Edit Bigin Variable page appears, update the details as needed.
When you update a Bigin variable, you can only edit the following field values:
- Variable Name
- Variable Status for Hidden and Read Only variables
To update the custom function, from the list of Bigin Variables, under Field Value - On Change, click the Edit Script link of a Bigin variable. When the Deluge Script editor appears, update the script of custom function as needed, and click Save.
On the Bigin Variable page, from the list of Bigin variables, hover over the variable you want to remove, and then next to Variable Name, click the Delete icon. When the confirmation window appears, click the Delete button.
If the Bigin variable is added to any of the places, such as email templates, custom functions or webhooks, you must disassociate those variables before deleting them from the Bigin Variables section.