smoServer Functions

Last modified on 2023/07/04 14:34

   Caution:

  • The EasyVista team will only resolve any issues related to the functions documented on this page.
  • Other functions exist but are for internal use only. The EasyVista team will not resolve any issues related to the modification of these functions and its impact on your platform.

   These functions can only be used in Service Manager. They cannot be used in SQL or Monitoring.

smoServer functions are Service Manager extended functions used to perform different actions and calculations in process steps (workflows and business rules).

Notes

  • The names of functions are not case-sensitive.

    example  getSLADelay and GETSLADELAY are identical

  • Dates and service hours:
    • Are stored in Universal Time (UT  = GMT + 0:00).
    • Are displayed in the interface in local time based on the location of the logged-in user.
    • Must be expressed in Universal Time (UT  = GMT + 0:00) if they are hard-coded.

example  Intervention end time  = 11:15 (GMT + 0:00)

  • The location of the logged-in user is Brussels (GMT + 1:00) ==>  time passed as a parameter  ="12:15"
  • The location of the logged-in user is Cape Verde (GMT - 1:00) ==>  time passed as a parameter  ="10:15"

Caution

  • To avoid updating the entire database inadvertently, and to restrict processing to the current object, a WHERE clause is automatically added in certain cases when this clause is not present in the SQL instruction.
    • Remember to always add this clause manually because it is only added automatically in specific cases.
    • The presence of duplicate WHERE clauses will not generate any error in the system.

Best Practice

  • You should always use the syntax below when using a smoServer function in a SELECT instruction.
    SELECT {@ smoServerFunction(parameters) @}
    FROM <TableName>
    WHERE ...

example  

SELECT {@ getSLADelay(SD_REQUEST.CREATION_DATE_UT, '12/06/2021 11:15:00', SD_REQUEST.SLA_ID, AM_REQUESTOR.LOCATION_ID) @}
FROM SD_REQUEST
INNER JOIN AM_EMPLOYEE AM_REQUESTOR ON AM_REQUESTOR.EMPLOYEE_ID = SD_REQUEST.REQUESTOR_ID
WHERE REQUEST_ID = @@ID@@
  • To identify the current object, you can either use the @ID@ or the @@ID@@ instruction.
  • To retrieve the result of the SELECT instruction, use an instance variable. Open url.png See the graphic process editor.
    • The result is retrieved via a tag in the following format, #[VAR.My_Variable]#.
    • Based on the type of instance variable, quote marks may be required.
      • Alphanumeric variable or date: Surround the tag using quote marks.
      • Numeric variable: No quote marks required.

example  

  • My_Variable = 'Hello'  ==>  tag  ' #[VAR.My_Variable]# '
  • My_Variable = '09/06/2021'  ==>  tag  ' #[VAR.My_Variable]# '
  • My_Variable = 99999  ==>  tag  #[VAR.My_Variable]#

List of functions

  • getSLADelay:  getSLADelay(Start_Date, End_Date, SLA_ID, Location_ID)
  • smo_Tree_Get_Path:  smo_Tree_Get_Path(TableName, ID, Separator, IDonly, IfDomain, BeginLevel, EndLevel)
  • smoAddTime:  smoAddTime(DateTime, Working_Hours_ID, Increment, Location_ID, SLA_ID)

Procedure: How to use a smoServer function in a process

    Open url.png See the graphic process editor.

UseFunctionInProcess_Procedure

Step 1: Run the smoServer function in a process step.

1. Create an Internal Update Step. Open url.png See List of action types.

         smoServer functions in process - Select step.png

2. Define the SQL script of the step used to run the smoServer function for the current record. This will be a SELECT instruction for calling the function.

3. Create an instance variable to store the result of the SQL script.

  • Value Type = Variable indicating that the instance variable is estimated when the process is run.
  • Variable / Value = @RESULT referring to the result of the SQL script.
     

Step 2: Update the record with the result of the SQL script.

1. Create an Internal Update Step.

         smoServer functions in process - Update step.png

2. Define the SQL script used to update the current record with the result of the SQL script. This will be an UPDATE instruction for calling the instance variable.

EndUseFunctionInProcess_Procedure
Tags:
Powered by XWiki © EasyVista 2022