Change variable field value into different language
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 09:02 AM
Hi All,
Need some urgent help with below, Thanks in advance..
Requirement: I have one record producer having diff variables, in those we have 2 single line text variables,
when the user open the record producer form and user enter anything in the 1st single line text automatically the 2nd single line text need to convert the input text from previous variable to 'German language ' ,
How we can get this??
@
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 12:50 PM
Hi, based on my understanding of your question from the information you’ve provided, you could potentially try the following.
To automatically convert text from one single line text variable to another in a different language (e.g., from English to German) in a ServiceNow record producer, you can use Business Rules and scripts. Here's a high-level overview of the steps to achieve this:
- Create the Variables:
- Create the two single-line text variables in your record producer form.
- Create a Business Rule:
- Go to System Definition > Business Rules.
- Click on "New" to create a new Business Rule.
- Configure the Business Rule:
- Give the Business Rule a name and a short description.
- Set the table to the table where your record producer is located.
- Configure the conditions that trigger the Business Rule. In your case, you want the Business Rule to trigger when the first single-line text variable is updated. So, set the conditions accordingly.
- Add Script Action:
- In the Business Rule, add a script action that performs the language translation and updates the second single-line text variable.
- You can use a JavaScript function to translate the text. You may need to use an external translation service or library to achieve this. For example, you can use a translation API like Google Translate or an open-source library like i18next if available in your environment.
- Once you have the translation, update the second single-line text variable with the translated text.
Here's an example of how your script action might look (assuming you have a translation function):
Now, when a user enters text into the first single-line text variable and saves the record producer form, the Business Rule will trigger, translate the text to German, and update the second single-line text variable with the translated text.
Please note that you will need to implement the actual translation logic within the translateToGerman function based on the available translation services or libraries in your ServiceNow instance. Additionally, make sure you have the appropriate permissions and API access for any external translation services you use.
I hope this is helpful & Good Luck.
James @Ecostratus