System Calls let you run predefined SmartSimple functions on the server from inside a Browser Script custom field, without writing client-side JavaScript. Because the code runs on the server, System Calls perform well, stay stable across releases, and require no JavaScript knowledge to set up. For the full list of available functions and their parameters, see System Call Functions and Syntax Reference.
Who: Global administrators
When to Use System Calls
Use System Calls when:
- Updating the status of an object or triggering a workflow when a record loads or saves.
- Activating or deactivating a contact as a user directly from the contact profile.
- Sending a password reset to a user from a button on their record.
- Adding or removing roles, or updating a contact association, without scripting.
- Incrementing or updating a system variable as part of a calculation.
Add a System Call to a Browser Script Field
To add a System Call to a Browser Script field:
- Navigate to the Custom Field settings for the applicable UTA/module.
- Click the edit [pencil] icon for the Browser Script custom field where the System Call should run.
- Click the Custom Script field and enter the System Call using the following syntax:
<!--SysCall_function(@parameter 1@,@parameter 2@,@parameter N@)-->
- Replace the function name and parameter with the call needed. Possible functions and parameters include:
- Update status – SysCall_updatestatus(objecttype,objectid,'StatusName')
- Call workflow – SysCall_workflow(objecttype,objectid,'WorkflowTriggerName')
- Activate and deactivate a user – SysCall_activatepeople(userid,activateType)
- Send a password to a specified user – SysCall_sendpassword(userid)
- Update a user role – SysCall_updaterole(userid,updatetype,'rolesNamesDelimitedByCommas')
- Update a system variable – SysCall_updatesysvar('VariableName','VariableValue')
- Update associations – SysCall_updateassociation(companyid,userid,'role name',updatetype)
- Run a charity check – SysCall_charitycheck(companyid)
- To run more than one call, enter each System Call on its own line in the same script field.
- Click Save.
Set the Trigger for a System Call
The trigger on the Browser Script field controls when the System Call runs. To select the trigger that matches when the call should execute:
- Navigate to the Custom Field settings for the applicable UTA/module.
- Click the edit [pencil] icon for the Browser Script custom field where the System Call should run.
- Select a Trigger Type from the drop-down menu. The options include:
- On Load – The server runs the System Call when the page is requested.
- On Demand – The server runs the System Call when the user clicks a button on the page. The Show Button in Footer setting allows the button to appear in the footer rather than on the page. The Show in View mode setting allows the button to be exposed in both view and edit mode.
- On Save – The server runs the System Call when the page is saved.
- Click Save.
On Demand System Calls pass the button element to the function as the parameter el. Use el to disable the button or change its label once the function finishes. For example:
<!--SysCall_workflow(@objtype@,@objid@,'Test Web Services')-->; el.value="Done"; el.disabled=true;
Create a Button to Activate a Contact
To create an On Demand button on the contact profile that activates the contact as a user and assigns the Organization Contact role:
- Click the System Administration gear in the upper navigation bar, and then select Global Settings from the drop-down menu.
- Click the Users tab, locate the General Settings section, and then click Custom Fields.
- Click New Field [+].
- Select Special – Browser Script from the Field Type drop-down menu.
- Select On Demand from the Trigger Type drop-down menu.
- Click Custom Script and add an activatepeople System Call to activate the contact, followed by an updaterole call to assign the Organization Contact role.
- Click the Permissions & Availability tab and locate the Visibility section.
- Click the Visibility Condition field and set a visibility condition so the button appears only on inactive contact records.
- Locate the On New Record field and click Hide on New Record.
- The call will not function until the contact record has been saved for the first time.
- Click Save.
Create a Button to Deactivate a Contact
To create an On Demand button on the contact profile that disables the contact's user access:
- Click the System Administration gear in the upper navigation bar, select Global Settings, and click the Users tab.
- Locate the General Settings section, and then click Custom Fields.
- Click New Field [+].
- Select Special – Browser Script from the Field Type drop-down menu.
- Select On Demand from the Trigger Type drop-down menu.
- Click Custom Script and add an activatepeople System Call with an activateType of 0 to deactivate the existing user.
- Click the Permissions & Availability tab and locate the Visibility section.
- Click the Visibility Condition field and set a visibility condition so the button appears only on active contacts, which also prevents users from disabling their own accounts.
- Locate the On New Record field and click Hide on New Record.
- The call will not function until the contact record has been saved for the first time.
- Click Save.