Folio lets users create pre-configured libraries. When a user creates a document in a specially configured AODocs Folio library, a new pre-configured library is created.
This article is for administrators of Folio libraries who are setting up Folio on their domain.
Add the following custom scripts to add to each Folio library:
![]() |
![]() |
![]() |
![]() |
Custom script required to use Folio
This custom script is required to manage the libraries you create with Folio. It allows you to create, update and delete libraries by creating, updating and deleting documents in your Folio libraries.
As a library administrator of a Folio library:
1. Open the library administration and select Custom Scripts.
2. Press <Add a new value> and name your new custom script.
3. Select the Update Action type from the drop-down list.
4. Press the name of your new custom script to configure it.
5. Leave the default option Run with current user's privileges for the Security mode.
6. Add the following optional parameters and values:
- parameter:
Backend_Url
value:https://folio.eu.aodocs.app/_ah/api/folio/v1/router
orhttps://folio.aodocs.app/_ah/api/folio/v1/router
- parameter:
Backend_Url_migration
value:https://folio.eu.aodocs.app/_ah/api/folio/v1/routerMigration
orhttps://folio.aodocs.app/_ah/api/folio/v1/router
- parameter:
Url_Field_Name
value:Library Link
- parameter:
Library_Field_Name
value:Library Name
- parameter:
Is_Migration_Field_Name
value:Migration ID
- parameter:
Backend_Tech_User
value: [email address of your domain's technical account]
Learn more about Folio instances: Access Folio.
7. Copy and paste this code snippet into the Imports field (overwrite the existing text):
import com.altirnao.aodocs.custom.*; import com.google.appengine.api.urlfetch.FetchOptions;
import com.google.appengine.api.urlfetch.HTTPHeader; import com.google.appengine.api.urlfetch.HTTPMethod;
import com.google.appengine.api.urlfetch.HTTPResponse; import com.google.common.collect.ImmutableList;
import com.google.gson.JsonObject; import com.google.gson.JsonParser; import
org.json.JSONObject; import org.json.JSONArray; import java.util.ArrayList; import
java.util.Arrays; import java.util.List;
8. Copy and paste this custom script into the bottom field (overwrite the existing text).
9. Press Compile.
10. Press Save.
Custom script to create a snapshot document
This custom script is required to create a snapshot document that you can use to create a snapshot of a library created with Folio.
As a library administrator of a Folio library:
1. Open the library administration and select Custom Scripts.
2. Press <Add a new value> and name your new custom script.
3. Select the Update Action type from the drop-down list.
4. Press the name of your new custom script to configure it.
5. Leave the default option Run with current user's privileges for the Security mode.
6. Add the following optional parameters and values:
- parameter:
SNAPSHOT_ROLE
default value:Snapshot Users
description:Name of the role that has access to the Snapshot feature
- parameter:
SNAPSHOT_CLASS_NAME
default value:Snapshot
description:Name of the Snapshot class
- parameter:
REQUESTER_FIELD_NAME
default value:Requester
description:Name of the field to store the requester email
- parameter:
REQUEST_DATE_FIELD_NAME
default value:Request Date
description:Name of the request date field to store the date of the request
- parameter:
ACCESS_FIELD_NAME
default value:Access
description:Name of the access field
- parameter:
ENGAGEMENT_SNAPSHOT_RELATION
default value:SOP - Snapshot
description:Name of the relation between the SOP and the Snapshot
7. Copy and paste this code snippet into the Imports field (overwrite the existing text):
import java.util.*;
import com.altirnao.aodocs.common.script.*;
import com.altirnao.aodocs.custom.*;
8. Copy and paste this custom script into the bottom field (overwrite the existing text).
9. Press Compile.
10. Press Save.
Custom script to create a snapshot library
This custom script is required to create a snapshot of a library created with Folio from your snapshot document.
As a library administrator of a Folio library:
1. Open the library administration and select Custom Scripts.
2. Press <Add a new value> and name your new custom script.
3. Select the Workflow transition action type from the drop-down list.
4. Press the name of your new custom script to configure it.
5. Leave the default option Run with current user's privileges for the Security mode.
6. Add the following optional parameters and values:
- parameter:
BACKEND_URL
default value:https://aodocs-folio-qa.appspot.com/_ah/api/folio/v1/createSnapshot
- parameter:
ENGAGEMENT_SNAPSHOT_RELATION
default value:SOP - Snapshot
whereSOP - Snapshot
is the name of the relation between the document classes in your Folio library - parameter:
LIBRARY_ID_FIELD_NAME
default value:Library ID
- parameter:
ACCESS_FIELD_NAME
default value:Access
7. Copy and paste this code snippet into the Imports field (overwrite the existing text):
import com.altirnao.aodocs.custom.*;
import com.google.appengine.api.urlfetch.FetchOptions;
import com.google.appengine.api.urlfetch.HTTPHeader;
import com.google.appengine.api.urlfetch.HTTPMethod;
import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
8. Copy and paste this custom script into the bottom field (overwrite the existing text).
9. Press Compile.
10. Press Save.
Custom script to delete a snapshot library
This custom script is required to delete a snapshot of a library that you created with Folio from your snapshot document.
As a library administrator of a Folio library:
1. Open the library administration and select Custom Scripts.
2. Press <Add a new value> and name your new custom script.
3. Select the Workflow transition action type from the drop-down list.
4. Press the name of your new custom script to configure it.
5. Leave the default option Run with current user's privileges for the Security mode.
6. Add the following optional parameters and values:
- parameter:
BACKEND_URL
default value:https://aodocs-folio-qa.appspot.com/_ah/api/folio/v1/deleteLibrary
- parameter:
LIBRARY_URL_FIELD_NAME
default value:Link to Snapshot Library
7. Copy and paste this code snippet into the Imports field (overwrite the existing text):
import com.altirnao.aodocs.custom.ReadableDocument;
import com.altirnao.aodocs.custom.Url;
import com.altirnao.aodocs.custom.UrlFetchService;
import com.altirnao.aodocs.custom.ValidationException;
import com.google.appengine.api.urlfetch.FetchOptions;
import com.google.appengine.api.urlfetch.HTTPHeader;
import com.google.appengine.api.urlfetch.HTTPMethod;
import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
import java.util.List;
8. Copy and paste this custom script into the bottom field (overwrite the existing text).
9. Press Compile.
10. Press Save.