- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi everyone,
I noticed in the ServiceNow documentation for the g_form.setClientData(String key, String value) API, it states that the value parameter is of type "Number." However, in practice, it seems possible to store strings and other data types as well.
Is this a documentation mistake, or is there a specific reason for restricting the value to numbers? Has anyone else experienced this or received clarification from ServiceNow?
Looking forward to your insights and experiences!
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Anand,
You have eagle eyes! You are absolutely correct, and your own screenshot proves the discrepancy.
This is definitely a documentation error.
If you look closely at the Header in your screenshot, the method signature is correctly defined as: setClientData(String key, String value)
However, the Parameter Table below it incorrectly lists the type as Number.
The Technical Reality:
Actual Behavior: The method is designed to accept and store Strings.
Under the hood: Even if you pass a number, the system treats it as a string because the corresponding retrieval method, g_form.getClientData(key), always returns the data as a String.
So, you can safely ignore the "Number" type in the table. It is a typo in the documentation. Trust the method signature (and your own experience) instead.
If this clarifies the confusion, please mark it as Accepted Solution.
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Anand,
You have eagle eyes! You are absolutely correct, and your own screenshot proves the discrepancy.
This is definitely a documentation error.
If you look closely at the Header in your screenshot, the method signature is correctly defined as: setClientData(String key, String value)
However, the Parameter Table below it incorrectly lists the type as Number.
The Technical Reality:
Actual Behavior: The method is designed to accept and store Strings.
Under the hood: Even if you pass a number, the system treats it as a string because the corresponding retrieval method, g_form.getClientData(key), always returns the data as a String.
So, you can safely ignore the "Number" type in the table. It is a typo in the documentation. Trust the method signature (and your own experience) instead.
If this clarifies the confusion, please mark it as Accepted Solution.
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Itallo Brandão
Thanks for your simple and precise explanation.
