Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormatException when applying valid filter &sysparm_display_value=true on CI mapping #8

Open
Manj75 opened this issue Oct 1, 2019 · 2 comments

Comments

@Manj75
Copy link

Manj75 commented Oct 1, 2019

Hi Herve,

I've encountered a bug in the ServiceNow plugin which I hope you can easily resolve soon (I know you're a busy man).

I'am trying to return results with display labels using the filter in the CI mappings of the ini file:

archi.elements.cmdb_ci_app_server.filter = &sysparm_display_value=true

This generates the following URL REST request:

https://{instance}.service-now.com/api/now/table/cmdb_ci_app_server?sysparm_limit=150000&sysparm_fields=operational_status,sys_id,name,short_description,sys_class_name,owned_by,tcp_port,type,version,sys_updated_on,sys_updated_by,u_asset_risk_score,sys_created_on,sys_created_by,u_dr_priority,sys_id,name,location,sys_class_name&sysparm_exclude_reference_link=false&sysparm_query=operational_status=1,&sysparm_display_value=true

and from the log it can be seen that the response is successfully returned, however a NumberFormatException is thrown, because the <operational_status> is returning a String (display label) and is expected as a number, i.e. 1 - Operational.

It would be great if you could handle this filter such that if when set to true the logic also recognises the string value of Operational. Even better is if you the plugin handles the filter with the value of 'all' then both the actual value and display name is returned, and if it either can be referenced.

I want to use it to create Archi concept folder names based on the display lablel not the actual database value, i.e.

archi.elements.cmdb_ci_app_server.folder = "Enterprise ServiceNow ITSM"/"Software"/"Application Servers"/sys_class_name

where sys_class_name returns the display label if the filter is specified.

@herve91
Copy link
Contributor

herve91 commented Oct 1, 2019

I will check how to handle this.

@herve91
Copy link
Contributor

herve91 commented Oct 2, 2019

For reference, should manage all three situations:

  • &sysparm_display_value=false (standard behaviour)
  • &sysparm_display_value=true (Only brings back the configured Choice display labels)
  • &sysparm_display_value=all (Brings back both the Choice display labels and the raw database value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants