Declarative translated_text localization is not supported for SDK-managed records #85
Unanswered
toshikiO
asked this question in
Help and Questions with SDK or Fluent
Replies: 1 comment
-
|
Hi everyone, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
The Fluent API has no supported way to declaratively define translated labels for
translated_text-type fields (e.g.,sys_properties.description). The SDK-generated translation records are created in the app scope and are silently rejected by the ServiceNow instance at install time — meaning translations simply do not appear afternow-sdk install.This affects any field backed by
sys_translated_text, not justsys_properties.description. The impact is significant for global/multi-language deployments where property descriptions and other translatable text need to be localized.Root Cause Analysis
The root cause is a cross-scope conflict between how the SDK generates records and how the ServiceNow platform enforces scope ownership on
sys_translated_text.1. The
descriptionfield type istranslated_textsys_properties.descriptionis of typetranslated_text. The platform stores translations as separate rows insys_translated_text, distinguished by(tablename, fieldname, sys_id, language).The Property Fluent API exposes
descriptionas a plainstring:There is no array-based localization option analogous to the
labelarray used forsys_documentation. Attempting to pass an array causes a compile-time error:2. Record API workaround is silently rejected at install
A workaround via the Record API — directly creating
sys_translated_textrows — appears correct in the generateddist/XML but is silently dropped duringnow-sdk install:After install, no corresponding
sys_translated_textrow exists on the instance. There is no error message or warning in the install output.3. GUI translation works correctly
Translations created via the platform UI under Global scope (
System Properties > [open record] > Translated Text tab) work normally. The platform's own scope check passes because the record is authored in Global scope.This confirms the problem is not in the
sys_translated_texttable itself, but in the SDK always generating records under the app scope.Steps to Reproduce
Verified on
@servicenow/sdk@4.7with a real instance deployment.Attempt A: Array syntax in
descriptionResult:
TS2322compile error.descriptionis typed asstring; array syntax is rejected.Attempt B: Record API for
sys_translated_textResult: Build succeeds and the record appears in
dist/XML. However, afternow-sdk install, the record does not exist on the instance. No error is reported.Attempt C: GUI-created translation (Global scope)
Navigate to the property record on the instance → open the Translated Text related list → add a row with
language = ja.Result: Works correctly. The Japanese description displays when the browser locale is set to Japanese.
Conclusion
There is no SDK-supported way to declaratively define
translated_texttranslations. All three paths either fail at compile time, are silently dropped at install time, or require manual GUI intervention — which defeats the purpose of source-controlled declarative configuration.Impact
sys_translated_text, cannot have translations managed in source control. This forces manual GUI steps after every deployment.sys_documentation. Translatable text fields (sys_translated_text) being the exception makes the i18n story incomplete and confusing.sys_translated_textrecords produces no warning, making this extremely difficult to diagnose without deep knowledge of ServiceNow's scope model.Environment
@servicenow/sdk: 4.7.0Beta Was this translation helpful? Give feedback.
All reactions