- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
From external system to transform table I'm receiving the amount as- 100 EUR which I'm mapping it to a table which has the field 'u_amount' which is of type price. I have written a script for the transform but only the value(100) is getting populated. What I am expecting is it is EUR then the currency type should be €.
answer = (function transformEntry(source) {
if (source.u_price) {
var parts = source.u_price.split(' ');
if (parts.length === 2) {
var amount = parseFloat(parts[0]);
var currency = parts[1].toUpperCase();
target.u_currency1.setValue(amount,currency);
}
}
})(source);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
you should set currency as well
Don't use field map, please use onBefore transform script for this
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var parts = source.u_price.split(' ');
if (parts.length === 2) {
var amount = parseFloat(parts[0]);
var currency = parts[1].toUpperCase();
target.u_currency1.setValue(currency + ";" + amount);
}
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
you should set currency as well
Don't use field map, please use onBefore transform script for this
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var parts = source.u_price.split(' ');
if (parts.length === 2) {
var amount = parseFloat(parts[0]);
var currency = parts[1].toUpperCase();
target.u_currency1.setValue(currency + ";" + amount);
}
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader