UCMDB and UD Practitioners Forum (Previously CMS)
Showing results for 
Search instead for 
Do you mean 

UD 10.01 AM Push Adapter accessing cpu_specifier_enum

Occasional Visitor

UD 10.01 AM Push Adapter accessing cpu_specifier_enum

How can I access cpu_specifier_enum in groovy function, I am trying to push cpu_specifier field from CPU CI to Asset Manager, but its pushing integer value instead of string, the integer value seems to the enum value, so i need to convert the integer enum value to its string, but when I tried to acces the enum in Groovy function it threw an error that the attribute is not recognized, is anybody using any out of the box enums in groovy functoions?

1 REPLY
HPE Expert

Re: UD 10.01 AM Push Adapter accessing cpu_specifier_enum

Hi,

That's difinetelly a tricky question.

When the adapter starts the start(PushDataAdapterEnvironment env) method of the groovy connector is called.

Taking a look at the env – it contains a method called ClassModel getLocalClassModel()… and the ClassModel contains all enums definitions.

 

So during the mapping you can use this ClassModel to convert your enum key to values.

 

Hope this helps.

Regards
-Dmitry Gomel, PMP
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
Click the Like button at the bottom to say 'Thanks'.
//Add this to "OnDomLoad" event