Java API code to create new incident

chitrat
Tera Contributor

Hi All,

Am new to ServiceNow and in the process valuating it.

Here my requirement is I need to create a new incident with the Java code.

Can anyone help me with the API Java code to create new incident on ServiceNow?

Thanks in advance

Chitra

1 ACCEPTED SOLUTION

tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi Chitra,



There is example java code here:


Table API Java Examples - ServiceNow Wiki



3.2 POST


..



Does that help answer your question?



Best Regards



Tony


View solution in original post

24 REPLIES 24

chitrat
Tera Contributor

I found the answer for my last question..


Yes it is possible to assign the incident to a particular user/user group.


Also we can give parameters to all the fields through API code.


Changes needs to be done in postData value.


String postData = "{\"short_description\":\"incident created through java code\",\"assigned_to\":\"network user1\"" +


                                                    ",\"impact\":\"1 - High\",\"urgency\":\"1 - High\",\"assignment_group\":\"Network\"}";


we need to place the exact field label and a value that's it.



Thanks


Chitra


HI Chitrat,



I am new to ServiceNow and looking for the integration of ServiceNow with Oracle Identity Management.


I am looking to create/update/delete incident from OIM.



Could you please share the java code for these operations as you have done it successfully.



Thanks so much in advance.


chitrat
Tera Contributor

Hi Dharampal Bishtm,



Welcome to Servicenow.. The link which is given by Tony has all the necessary code snippet.



Did you give a try..? Are you facing any problem with the code..



Why am asking is, I was able to succeed with that code.. And I simply tried to execute the code from eclipse, did not integrate it with any tool.



Please let me know in-case if you need any help



Thanks


Chitra


Hi Chitrat,



I just saw your post on creating incident through java api. Can u provide me the code in detail. It would be a great help. Thank you


Hi Priya,



I think Chitrat used this example here:


Table API Java Examples - ServiceNow Wiki



Give it a try? It should/does work.



Best Regards



Tony