Get the key and value from a dropdown when processing the dialog


#1

Hi,

I have a dropdown that is dynamic and based on a generated key-value list. When processing the dialog, I only get the selected key in the dialog back. I’d like to also get the value and I have no clue where to find it. I’ve inspected the $evm.root, $evm.current and $evm.parent objects but I have not found the value (or the entire key-value list, which would also work for me).

Tips, even incomplete would be very much appreciated.

Thank you,

Philippe


#2

@dclarizio can you review this question from @phmo and forward to a SME if necessary.


#3

@eclarizio, can you help out here? Thx, Dan


#4

@phmo, I think you can get the full key/value hash by doing $evm.attributes[‘name_of_your_dialog_field’][‘values’]

@gmccullough Does that sound right?


#5

@eclarizio, $evm doesn’t seem to have the variable attributes. I get the following error:
NoMethodError: undefined method `attributes’ for #MiqAeMethodService::MiqAeService:0x00000004eb8df0

I’ve also tried $evm.root[‘project’][‘values’], but that seems to be empty/Nil

If I check $evm.instance_variables, I get [[at]uri, [at]ref] (with [at] the @ sign, because the forum thinks @ indicates a user)

I’m using cloudforms version 5.5.3.4.20160407153134_b3e2a83, so maybe that’s why the attributes variable doesn’t exist yet?

I’m rather new to ruby in general, so if there is something else I could check, let me know.


#6

Hi @phmo,

Currently the only item passed to automate from the dynamic field is the key as you already discovered.

I would suggest opening an issue and we can look into passing the other items (value, full key/value pairs) that you are interested in.


#7

Ok done, issue created at: https://github.com/ManageIQ/manageiq/issues/10939