How to prefill data for a ServiceNow form when calling openServiceNowForm()?

Mike217
Kilo Contributor

Dear reader,

The global openFrameAPI contains a method called openServiceNowForm(). The example code below opens a new incident without prefilled data:

            openFrameAPI.openServiceNowForm({ entity: 'incident' query:'active=true' });

I would like to know if it is possible to modify the query part of the code above so that you can set input fields automatically. For example, values like: Caller, Location and Category are by default empty. The situation I want to accomplish looks like this: Caller=test-caller, Location=New York. Is this possible? Could you give an example? 

Thanks in advance.

Kind regards,

Mike Kruithof

Link to the documentation:

https://docs.servicenow.com/bundle/madrid-customer-service-management/page/app-store/dev_portal/API_...

1 ACCEPTED SOLUTION
3 REPLIES 3

sachin_namjoshi
Kilo Patron
Kilo Patron

you can use below blog to populate fields while using API

 

https://community.servicenow.com/community?id=community_blog&sys_id=596dea29dbd0dbc01dcaf3231f96190b

 

Regards,

Sachin

Mike217
Kilo Contributor

Thanks Sachin for your help. The link which you referred to answered my question.

Salim3
Kilo Contributor

Hi is there any way filling multiple values of form using openServiceNowForm() in query, the answers mention doing it using a URL, is there and example ?