Brandon May
ServiceNow Employee
ServiceNow Employee

Lately, we've been getting questions, particularly from international clients, regarding the ability to allow unauthenticated users (aka public users) the ability to change the language of the portal without having to log in, as shown in the screenshot below.

language with login.png

This is a good question, especially for portal administrators who want users to be able to send an email referencing a public KB article for their company or would like the visitor to be able to search the knowledge base, but want the public user to still have the ability to select their language. Here is a way (I'm sure there could be others) to quickly set this up for your visitors.

How to let public users select their language

Step 1. Set the Language Switch widget to 'Public'

The first thing you will need to do is set the Language Switch (sp-lang-switch) widget to public. You can do this by appending either of the following to your instance URL:

/sp_widget.do?sys_id=af0f73105b0122000d7ec7ad31f91a27

    • Check the 'public' box

/sp_config?id=widget_editor&sys_id=af0f73105b0122000d7ec7ad31f91a27

    • In the top-right corner, select the context menu icon and check the Public Widget box

public widget.png

Step 2. Set sys_language as a public page

Next, you will need to create a Public Pages record on the sys_public table:

  1. Go to /sys_public_list.do
  2. Click the New button
  3. Set the following:
    • Page: sys_language
    • Active: true

sys_landing public page.png

Step 3. Create two ACLs that allow read access to the Languages table

The final step will require you to allow read access to the sys_language table for public users. To do this, and have the language apply, you will need to allow access both on the table and field level. For this step, as an admin, you will need to elevate your roles to security_admin.

elevate roles.png

In a base instance, only one ACL for write access will be available for the sys_language table. Create the two following read ACLs:

Table level ACL

-------

Type: Record

Operation: read

Name: Language[sys_language]

Description: Allow read for records in sys_language, for users with role public.

Requires role: public

Field level ACL

--------

Type: Record

Operation: read

Name: Language[sys_language].*

Description: Allow read for records in sys_language.*, for users with role public.

Requires role: public

Now you are all set to allow public users the ability to apply a language without having to authenticate, as shown below:

BLOG.gif

It is worth noting that the language selected by the unauthenticated user will be removed upon authentication. This is because the language is based on the 'sys_user.preferred_language' setting. The language selected while not logged in will not carry over to the logged in session unless the user's profile has their selected language set to the same language they had set in their prior unauthenticated session.

Letting unauthenticated users dictate their language allows them to experience your instance without having to implement a user profile. This will come in handy if you ever need to utilize your Service Portal for public KB article, or any other public documentation you intend to distribute by way of link.

For additional information on language selection, be sure the check out the following product documentation:

As always, if there are any questions, be sure to leave a comment below and either I or someone else on the Community will help you out.

5 Comments