
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 05:27 PM
Hi all,
I'm trying to set a value in a currency field through client script:
This is my code:
=============================================
function onLoad() {
//Type appropriate comment here, and begin script below
var vls_pj = 0.0;
var total;
var valor = g_form.getDecimalValue('u_valor_liquido_impostos');
var sc = g_form.getDecimalValue('work_cost');
var pj = new GlideRecord('tsp1_project');
pj.addQuery('primary_program',g_form.getUniqueValue());
pj.query();
while(pj.next()){
vls_pj = vls_pj + parseFloat(pj.u_valor_total_contrato);
}
g_form.setValue('u_total_projects_value',vls_pj);
}
=============================================
Show this, no formatting...
What's wrong?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 05:34 PM
Hi Osvald,
This might help:
Regards,
Raf

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 05:34 PM
Hi Osvald,
This might help:
Regards,
Raf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 06:20 AM
For currency fields, you need to provide currency symbol along with the value. Please refer below code snippet
//Get value
var rate = parseFloat(current.base_rate);
// Get currency var currencyCode = current.base_rate.getCurrencyCode();
//Perform calculation
var totalCost = rate*current.hourly_rate;
//set the value currency.total_cost.setValue(currencyCode + ";" + totalCost);
Thanks!!