How Can We Help?

Search for answers or browse about Sintel Forms.

After save script

You are here:

Enable after save script – enables executing a custom js script right after an item has been saved.

It is possible to execute a custom script right after a form item has been saved. This allows you to set custom values of form fields with the possibility to use all the server-defined values as well (e.g. the ID field, which is not available before a new item gets saved into SharePoint).

Example

The example below will show you how to prepare a custom script which will update the “TextField” field of an item with a value that will combine two other field values: “ID” and “Date”.

let date = getDateTime("Date", "ddMMyy") 
let id = getValue("ID"); 

setValue("TextField", id + "_" + date);

When the ‘Date’ field will be empty the error will occur, however, the form will be saved (only the ‘TextField’ value won’t be changed).

List of available API functions to use in after save script:

Function
Description
getValue(fieldName)
Returns the value of a field.
getDateTime(fieldName,format)
Returns the value of a date/datetime field in the provided format. For a list of possible formats, see here.
setValue(fieldName,value)
Sets the value of a field.

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