Currency in Record Producer

salvadormarchan
Kilo Guru

Hi All,

 

To my surprise, I don't see any 'currency' (or equivalent) data type in the record producer's variable. So, I created two fields - one for the currency ("Old Currency" variable - datatype: Select Box; with dropdown values of world currencies) and one for the current value ("Old Price" variable - datatype: Single Line Text; with a client script that evaluates 2-decimal places numeric values).

In the target table, I have a field which can hold a currency   ("Old Price" field - datatype: Currency).

 

Question: How do I map "Old Currency" variable and "Old Price" variable into "Old Price" field?


In the record producer, there is a "Script" field and I may do server-side scripting. I can use "current"   to set values for the target table and I can use "producer" object to retrieve the "Old Currency" variable's value. I tried using a Glide Record to force the currency but no luck.

===========================================================

Here's my script so far:

var myOldCurrt = producer.oldCurrency.toString();

gs.log(current.sys_id,'MCS 1');

var old = new GlideRecord('fx_currency_instance');

old.addQuery('id', current.sys_id.toString());

old.addQuery('field', 'u_old_price');

old.query();

gs.log(old.getRowCount(),'MCS 2');

if(old.next()) {

    old.currency = myOldCurrt;

    old.update();

}

//var myNewCurrt = producer.newCurrency.toString();

===========================================================

I appreciate it for any tips or leads.

Thanks,

Dor

5 REPLIES 5