Search code examples
servicenowservicenow-rest-api

How can i get the specific view/layout meta fields with field attributes using Rest API


How can we get the meta fields with all attributes (like type,mandatory,display etc) based on view name for CSM objects (like contact,account etc) using Rest API.

Please provide detailed information. It will helpful for us.Thanks!

find metafields reference SS,

enter image description here


Solution

  • We Can achieve this using multiple API's.

    1. We need to get the elements(fields) name using view name and table(object) name.

    https://instance.service-now.com/api/now/table/sys_ui_element?sysparm_query=sys_ui_section.view.name=<<VIEW_NAME>>&sys_ui_section.name=<<TABLE_NAME>>
    

    2. Then we can use sys_dictionary table to get element attributes using table name and elements name ( What we get from #1 API ).

    https://instance.service-now.com/api/now/table/sys_dictionary?sysparm_query=name=<<TABLE_NAME>>^ORelement=<<ELEMENT_NAME>>
    

    I followed the above things and it's worked for me.