In this scenario we have a company with a HQ office in the USA & regional offices in France. The users of the CRM system in France need to enter their notes about the Case record in French and so this needs to be translated to English which is the global language for the company.
To complete this we are going to use Microsoft Cognitive Service Text Translation API.
To access the Microsoft Translator Text Translation API you will need to sign up for Microsoft Azure. Follow these steps.
- Sign up for a Microsoft Azure account at http://azure.com
- After you have an account go to http://portal.azure.com
- Select the + New option.
- Search for 'Translator Text' and select it ( should be under the category AI + Machine Learning)
- Read the text and click on Create
- In the Pricing Tier section select the pricing tier that fits your needs.
- Fill out the rest of the form, and select the Create button.
- You are now subscribed to Microsoft Translator.
- Go to All Resources and select the Microsoft Translator API you subscribed to.
- Go to the Keys option and copy your subscription key to access the service.
N52 Formula Manager Solution
The Formula Manager solution works like this,
- We create a formula of type 'Save - To Current Record' on the Case entity
- Set the Source Property to be the Local Language field
- Add in the API key from Azure into the AzureCognitiveIssueToken() function
- The web-service returns the text translated to English
- This result is put into the Global Language field
N52 Formula Manager Steps
The following set of steps will set this formula up for you.
- Create a new formula of type 'Save - To Current Record'
- Set the Source Entity to 'Case'
- Set the Event to 'Create & Update'
- Set the Source Property field to 'Local Description'
- Set the Target Property to 'Global Language'
- Copy and paste the formula below into the formula canvas
- Copy in your API key
- Click Save and you are ready to test
iftrue(Containsdata([incident.new_locallanguage]), CallRestAPI( SetRequestBaseURL('https://api.microsofttranslator.com/v2/http.svc/'), SetRequestResource('Translate'), SetRequestDetails('Get'), SetRequestHeaders(), SetRequestParams('appid', 'Bearer ' + AzureCognitiveIssueToken('xxxxxxxxxxxxxxxxxxxxxxxxxxx'), 'to', 'en', 'text', [incident.new_locallanguage] ), SetRequestAuthenticationNone(), SetRequestFiles(), SetRequestExpected('OK'), SetRequestActionPass(GetVarXPathValue('.')), SetRequestActionFail('NoOp') ) )