Negative value in currency field

sruthivarghese
Tera Contributor

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

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@sruthivarghese 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

It's ok to have currency fields with negative as per ServiceNow. 

Saiganeshraja
Kilo Sage
Kilo Sage

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.