Create an Object Function Server Script
As an administrator, you must define the object function server script to be used by the Go to Microsoft Teams smart action to retrieve the Microsoft Teams URL associated with the record.
Here’s how to define the GoToTeams function server script in Application Composer.
- Navigate to to create and enter a sandbox with Application Composer.
- From the sandbox, open Application Composer from the Tools menu.
-
In Application Composer, expand the Standard Objects node, and then expand Opportunity.
Note: You can also use these steps to create a team and access Microsoft Teams for other objects such as custom objects as well. - Click Service Scripts as shown in this example
screenshot.
- Click the Object Functions tab to display a screen
similar to the following:
- Enter required details as follows:
- Function Name: GoToTeams
- Returns: String
- Visibility: Callable by External Systems
- Enter the following groovy sample
code:
def conn = adf.webServices.collaborations; try { def queryParams = ['q':'ObjectId='+OptyId] conn.dynamicQueryParams = queryParams def collabResponse = conn.GET() def weburl = "" if (collabResponse.count > 0 ) { weburl = collabResponse.items[0].Weburl; } return weburl; } catch(Exception ex) { println(conn.statusCode+""); //for diagnostic logging println(conn.httpErrorResponse+""); //for diagnostic logging throw ex; }
Note: You can copy the scripts provided to set up the integration for custom objects, but you must replace the OptyId value with the ID field for the custom object in all the sample scripts. - Click Validate.
- Click Save and Close.