- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2023 06:06 PM
We are using getClassDisplayValue in a integration to get the table name, it works fine. But In some cases the script include where we process the REST transaction is running into error. We observed that this is happening when the user preferred language other than EN. I feel it is because of getClassDisplayValue.
Can anyone recommend some best practice to prevent this issue.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 07:15 AM
@lalkrishnam If you are using a separate BR for every table you can use pass the table name directly, instead of getting it dynamically.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 09:07 AM - edited 12-10-2023 01:33 PM
Hi,
Do you have sys_documentation records for your languages and table name with element blank? I have those in my instance.
And from:
A test of the example there in scripts background shows:
// Display the incident table label
var now_GR = new GlideRecord("incident");
var value = now_GR.getClassDisplayValue();
gs.info("The table label is " + value + ".");
shows:
*** Script: The table label is FrenchForIncident.
when I set my language to French.
Activate the corresponding I18: [Language] Translation plugin and test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 06:37 AM
Thanks Bert for your response. It is helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:30 AM
Hi @lalkrishnam
For example, If you are using the getClassDisplayValue() return value as a parameter in GlideRecord it may fail the script execution. Why because, getClassDisplayValue fetches the Table label in logged in user preferred language if you are using i18n language plugins. Even though if you are not using i18n, the classDisplayValue is always table label not the name, so it will work for some tables like incident, problem etc where both lable and name are same. Where as for tables like change the lable and name are different.
I recommend you to use getRecordClassName() to fetch the table name instead of label.
Please mark my answer helpful and accept as a solution if it helped 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 06:40 AM
Thanks Anvesh for your response.
I'm using BR to trigger the integration. We have a separate BR for every module to trigger the integration by calling the same Script Include and we should pass the table name.
As we have a separate BR for every table, can I hard code the table name or dynamically get the table name using getRecordClassName?
Please suggest.