archi-contribs / snow-import-plugin

Service Now import plugin
Other
14 stars 5 forks source link

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

Open Manj75 opened 4 years ago

Manj75 commented 4 years ago

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 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 commented 4 years ago

I will check how to handle this.

herve91 commented 4 years ago

For reference, should manage all three situations: