Convert MB to GB for a cmdb record and catalog item

leachy23
Kilo Expert

HI all, 

I have come across an interesting one today which I'm looking for a bit of advice on.

Im currently building a form within the service catalog where users can request the addition or removal of CPU, RAM and Disk for existing VM's from the service portal. 

At the top of the form I have a reference field which references the server table within the cmdb to display the server name, I then have a client script/script include combo which then pulls in and displays the servers current CPU count and RAM.

The issue I've got is people order RAM in GB, but discovery updates the CI records with RAM in MB, so I need to somehow have the CI's RAM converted from MB to GB, I also need to make this conversion in a place that makes architectural sense. It seems that discovery updates the CI record directly rather than via a transform map(?) so I can't catch it there and if I make the conversion on the catalog items it's not really a scalable solution, is it best to create a new field on the CI form which references the MB ram and converts it?....also, how is the conversion calculated in JS?

 

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

If you want the CI to displayed in GB, then I would do a BEFORE INSERT/UPDATE BR that simply divides the value by 1024.

If you're OK with the CI storing MB and your primary concern is with the service portal field, then a client script can do it for you right before you display the value in that field.

View solution in original post

2 REPLIES 2

Chuck Tomasi
Tera Patron

If you want the CI to displayed in GB, then I would do a BEFORE INSERT/UPDATE BR that simply divides the value by 1024.

If you're OK with the CI storing MB and your primary concern is with the service portal field, then a client script can do it for you right before you display the value in that field.

Chuck Tomasi
Tera Patron

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

 

Thank you