Overview
The System Call feature of SmartSimple enables the execution of pre-defined system functions on the server, thereby eliminating the need for client-side scripting. The advantages of System Calls include:
- Enhanced performance and security, as code execution occurs on the server rather than in the client browser.
- Increased stability, as System Calls are developed by SmartSimple and optimized for the platform.
- No requirement for JavaScript knowledge to utilize this feature.
Utilizing System Calls
To utilize System Calls, you must incorporate the System Call references into a Browser Script custom field. The syntax for each System Call is as follows:
<!--SysCall_function(@parameter 1@,@parameter 2@,@parameter N@)-->
Note: Multiple System Calls may be embedded within the same script field.
Triggering System Calls
The execution of a System Call is governed by the trigger set for the Browser Script field. The following triggers are supported:
- On Load - The System Call is executed by the server upon page request.
-
On Demand - The System Call is executed by the server when the user clicks a button on the page.
- The button will be displayed for the Browser Script field when this trigger type is selected.
- It is important to note that this is the only instance in which the Browser Script field type is visible on a page.
- On Save - The System Call is executed by the server when the page is saved.
Please note that Browser Script fields triggered On Load or On Save are limited to the use of System Calls only, and cannot incorporate custom JavaScript, as they are processed server-side.
Examples of System Calls
<!--SysCall_updatestatus(@objtype@,@objid@,'StatusName')--> <!--SysCall_workflow(@objtype@,@objid@,'myworkflow')--> <!--SysCall_workflow(23,@parent.objid@,'myworkflow')--> <!--SysCall_workflow(levelone,@parent.objid@,'myworkflow')-->
-
- @objtype@ and @objid@ are reserved keywords.
- Objtype can be referenced by the integer value associated with the entity type (23, 18, 30, 40) or by using constants such as levelone, level1, leveltwo, level2, levelthree, level3, contact, people, company. Please refer to the Entity IDs for a comprehensive list of entity types.
- Important: Ensure there are no spaces between parameters (i.e., before or after the commas).
Note: If you are appending additional JavaScript after the System Call in an On Demand browser script, please add a semicolon at the end of the System Call to prevent script errors.
<!--SysCall_workflow(@objtype@,@objid@,'myworkflow')-->; alert("System call and alert work fine.");
On Demand system calls pass the button element to the function as parameter el. This can be utilized to disable the button or modify its value to indicate when the function has completed. For example:
<!--SysCall_workflow(@objtype@,@objid@,'Test Web Services')-->; el.value="Done"; el.disabled=true;
Available System Calls
The following System Calls are currently available:
SysCall_updatestatus(objecttype,objectid,'StatusName')
Updates the status of an object to a new status.
SysCall_workflow(objecttype,objectid,'WorkflowTriggerName')
Initiates a workflow.
SysCall_activatepeople(userid,activateType)
Activates a contact as a user. The activateType can be set to: 0 = deactivate existing users; 1 = activate user with access through the administrative or portal interface; 3 = activate user with access through the Applicant Tracking Interface only; 5 = activate user with access through web service login.
SysCall_sendpassword(userid)
Sends a password to the specified user, functioning identically to the "Send Password" button.
SysCall_updaterole(userid,updatetype,'rolesNamesDelimitedByCommas')
Updates user roles. The updatetype can be set to: 1 = Add roles to contact; 2 = Remove all existing roles and add new roles; 3 = Remove listed roles.
SysCall_updatesysvar('VariableName','VariableValue')
Updates an existing System Variable to a new value. For example, you can increment a numeric system variable called Number using an sscalculation:
<!--SysCall_updatesysvar('Number',<!--@sscalculation('@system.Number@'+1)-->)-->
SysCall_updateassociation(companyid,userid,'role name',updatetype))
Updates contact association. The updatetype can be set to: 1 = Add association; 2 = Update association; 3 = Remove association.
SysCall_charitycheck(companyid)
Executes the SmartSimple GuideStar Charity Check procedure against the specified company.
Note: Please consult the GuideStar Charity Check page for comprehensive information.
Examples
To display a button on the contact profile that will enable the user and assign the Organization Contact Role:
- Please note the visibility condition to ensure this button only appears on inactive contact records.
- Additionally, ensure it is set as Hide for New Record since this will not function until the contact record has been saved for the first time.
To display a button on the contact profile that will disable the user:
- Please note the visibility condition to ensure this button only appears on active contacts, and to prevent users from disabling their own accounts.
- Furthermore, ensure it is set as Hide for New Record since this will not operate until the contact record has been saved for the first time.
Proposed Additional System Calls
We welcome suggestions for additional system calls that could minimize the need for scripting. Please email SmartSimple Support or submit a support ticket to SmartSimple Support with the details of the System Call you wish to propose. Newly proposed System Calls will be incorporated into this article as they become available.