- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:35 PM
I have an excel sheet that has the ram in GB and I need it covered to MB on the computer cmdb_ci_computer table. The title on the excel is "DEVICE_MEMORY" and the values show as "10GB". I tried the script below but no luck, any advice?
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var deviceMemoryInt = parseInt(source.u_device_memory, 10);
if (!isNaN(deviceMemoryInt)) {
target.ram = deviceMemoryInt * 1024;
}
})(source, map, log, target);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 08:56 AM
Do you have the ram field on your field map? If so that maybe whats causing the issue with your script.
It would probably be easier to use a field mapping script. So add a field mapping and check the "Use source script" and use that script to do the calculation and then just return the value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 08:56 AM
Do you have the ram field on your field map? If so that maybe whats causing the issue with your script.
It would probably be easier to use a field mapping script. So add a field mapping and check the "Use source script" and use that script to do the calculation and then just return the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 01:17 PM
Yes, removing the field from the field map resolved the issue, thank you!