Functions are the building blocks for developing an extension. They come handy for all server side customization. Sigma executes functions without additional infrastructure cost. External function calls can be done using rest APIs. You have to generate an API token to call functions outside Sigma.
Sigma uses Deluge for building functions. Deluge script builder provides a drag-and-drop user interface which helps in creating functions quickly. Build anything from simple methods like sending an email notification to complex recursive functions using the editor. Click here to know more about writing functions in Deluge. Create a function
Let’s build a function to send an email notification
- Navigate to Functions module and click New Function at the top right corner.
- Enter a function name and give a description.
- Click Save.
- Open the newly created function.
- Drag and drop the send mail function under the Notifications section.
- Specify the from and to addresses, email subject, and the main text.
- Click Edit to add place holders to your email.
- Click Save.
Associate a function to an extension
Write a function and reuse it across your extensions wherever you require. You can associate a function to multiple extensions.
- Navigate to Extensions module, hover over your extension and click .
- Choose View and click Functions.
- Go to the Functions tab and click Associate function.
- Select sendmailnotification from the drop-down.
- Select Latest under Version.
- Click Associate.
- Your function is successfully associated with your extension.