Negative value in currency field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 11:05 PM
Hi,
I am trying to populate a negative value in a currency type field via workflow. However on the form, it appears as a positive value within parentheses. Is there any way I can fill in a negative value into the currency type field using server side script.
Thanks in advance,
Sruthi
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 11:08 PM
I don't think it is good to display currency in negative.
I am not sure if it would be allowed in ServiceNow.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2021 04:41 AM
It's ok to have currency fields with negative as per ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2021 04:31 AM
Use the below Script to update:
function run(currencyCode,totalCost) {
var gr = new GlideRecord('TableName');
gr.addEncodedQuery('YourQuery');
gr.query();
while (gr.next()) {
gr.variablename.setValue(currencyCode + ";" + totalCost);
gr.update();
}
return ;
}
run("USD",-1000);
Mark Correct.