- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 07:48 AM - edited ‎07-18-2023 07:49 AM
Hello all,
Recently I have been trying to create a VA topic that will change the user's preferred_language setting using a static list of choices and custom script. It seems like it should be a simple script to write, but throughout several iterations of the code I have written, there has not been anything that works. This is the current iteration of the code I have been using.
If anyone can find anything blatantly wrong or has ideas on what I should try, I would be grateful 🙂
Solved! Go to Solution.
- Labels:
-
Virtual Agent

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 09:15 AM - edited ‎07-18-2023 09:16 AM
Oke so the field to change is just a simple adjustment to the script like I mentioned. Assuming the vaInputs.language_choice is correct ofcourse.
Also noticed I forgot something... vaInputs.user is NOT the user_name, it's the user object and you could use sys_id or dotwalk any other field.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 08:35 AM - edited ‎07-18-2023 08:36 AM
Hi there,
Do perform a if(person.next() {} etc
Also wondering, you are trying to update the preferred language. Is it your assumption that the chat will then also process in a different language? Asking, because just updating this field won't change your session settings.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 09:11 AM - edited ‎07-18-2023 09:16 AM
As of right now, I am just trying to get the field to change. I figured it wouldn't change the session settings without reloading the page or starting a new Virtual Agent conversation.
I made use of your suggestion with running an if statement, and I put in an error message to be captured in the log with the else statement if it couldn't find anyone. The error message was captured in the logs, so I believe something about my query is wrong.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 09:15 AM - edited ‎07-18-2023 09:16 AM
Oke so the field to change is just a simple adjustment to the script like I mentioned. Assuming the vaInputs.language_choice is correct ofcourse.
Also noticed I forgot something... vaInputs.user is NOT the user_name, it's the user object and you could use sys_id or dotwalk any other field.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2023 09:21 AM
Thanks so much for the help 🙂 . I was able to get the topic to work for me.