- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 07:46 AM
Hi Community,
Good day! I am working on a notification and I just want to convert string value to number. This is for a custom notification that has configuration settings. Below is my script:
y - is the fieldname in the notifications config
var x = 'y';
var z = new customTable.ScriptInclude().getOptions('system_properties', x);
workflow.scratchpad.b = 2; //default value
if (z[x]){
workflow.scratchpad.b = (z[x]).value; // (z[x]).value this is the value being pulled from the configuration settings in the notification, value there is every 2 days --> this is the one that is returning as string and not a number
}
When I run in background script it is, I can see the value which is 2 but the typeof is returning as string. Can somebody advise how can I rewrite the script that will convert 2 from being a string to make it a number.
Thank you.
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 07:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 07:48 AM
Try :
workflow.scratchpad.b = parseInt((z[x]));
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 08:05 AM
Thanks Raghav.