Configure Microsoft Teams with Custom Scripts

You can configure Microsoft Teams to match your business requirements by writing custom scripts using JavaScript that enforce validations and rules.

You can create scripts for Microsoft Teams using the CX Sales Mobile script tools. You can also assign scripts for CX Sales Mobile to Microsoft Teams if the requirements for both channels are the same. You can add custom scripts for Microsoft Teams to Appointments, Call Reports, and Tasks for On Create, Before Save, and After Save events.
Note: To enable the custom scripts for Microsoft Teams feature, you must first create an Enable Custom Scripts for Microsoft Teams (CDA_ENABLE_CSS_TEAMS) profile option, and then set the option value to Yes. For more information, see Enable Custom Scripts for Microsoft Teams Profile Option.

Create a Script and Assign to Microsoft Teams

Here's how you create a script and assign to Microsoft Teams:

  1. Select the sandbox you want use for your configuration.

  2. Select Navigator > Application Composer > Mobile Application Setup.

  3. Click the CX Sales Mobile Scripts tab at the top of the Mobile Application Setup page.

  4. To create a script for a top-level parent object, select the object you want to write a script for, and then select the event that will trigger your script. You can choose one of these events:

    • On Create (triggered when a new record is created in the mobile app).

    • Before Save (triggered before a record is saved).

    • After Save (triggered after the app has saved the record).

  5. Click the plus icon in the <Event Name> Scripts section.

  6. Enter the script name and description.

  7. (Optional) If you want the script to work for particular regions, select geographical regions for the script. The script will work for users who have your selected regions as their country preference setting in the CX Sales app.

    Note: A script can have multiple regions associated to it, but the same region can't be assigned to more than one active script for the same object and event.

    If you want to restrict your script to trigger for certain user roles, you will need to specify these by writing a JavaScript script

  8. Select Microsoft Teams as your assigned channel and click Create to create your script.

    Example of the Create Script screen
  9. Click Validate to check whether your script has any errors. The validation checks include checks for nested functional calls and anything else in the script that will cause it to run forever in an infinite loop.

  10. When you're finished, click Save.

Assign Existing Scripts to Microsoft Teams

You can also assign existing scripts for CX Sales Mobile to Microsoft Teams if the requirements for both channels are the same.

Here's how you add an existing script and assign to Microsoft Teams.

  1. Select the sandbox you want use for your configuration.

  2. Select Navigator > Application Composer > Mobile Application Setup.

  3. Click the CX Sales Mobile Scripts tab at the top of the Mobile Application Setup page.

  4. Choose the event and locate the existing script that you want to assign to Microsoft Teams.

  5. Select Microsoft Teams as your assigned channel. Sample screenshot of adding an existing script to Microsoft Teams

  6. Click Validate to check whether your script has any errors. The validation checks include checks for nested functional calls and anything else in the script that will cause it to run forever in an infinite loop.

  7. When you're finished, click Save.