API Context

The API context exists in every Form Handler. This context exposes several methods which comes in handy when writing a handler code.
test
The API context exists in every Form Handler. This context exposes several methods which comes in handy when writing a handler code.
The following methods are available under the API context:
  • api.getProp("<prop reference name>")
    Fetches another prop in the form using the reference Name assigned to it under the prop configuration. By fetching another prop we can control its value, available options, label, visibility, and so on.
  • api.getRequester()
    Fetches the logged in user with the user details.
  • api.prompt("message")
    Prompts a message window to the user. The message format content supports HTML tags.
  • api.server(['<plugin name>','arg0', 'arg1', ….])
    Calls a server plugin available in the form context. Plugin must be linked to the form which is trying to initiate it.
    The result for this method is an object that look like this:
    {
       "returnValue": <THE_RETURN_VALUE_FROM_THE_PLUGIN>
    }
  • api.service('<service action name>', '<object id>', <init values>)
    Calls the service actions defined under the modules section. These tasks fetch initialization data. This method is useful when building a custom logic in the backend system and fetch the result into the form. For example, building a task which displays in the initialization the entire groups in the system. Using the api.service() call, call that task and return all the fields defined in the form as object to the handler.
    {
       "formDefId": 6,
       "initializationValues":[
          {
             "formProperty":{
                "name":"Test"
                "backendName":"%FIRST_NAME%",
                //... more attributes here
             },
             "values":["Allen"]
          },
          // ... more properties here
       ]
    }
  • api.getSubject()
    Returns an array of the managed objects in the context of the form. The managed object types are either user or group. If no managed object exists, an empty array will be returned. For example, a form in access request will return the users that are the subject of the request. An onboarding form for a user will return an empty array since the user does not exist yet.
  • api.getEntitlement()
    Returns a value only if used within forms in the Access Module. The method will return the permission name which the form is associated to.
  • api.getLocale()
    Returns the current locale of 
    Identity Portal
    .