jenkinsci / service-now-plugin

Build Jenkins workflow steps for the service-now API
https://plugins.jenkins.io/service-now/
MIT License
26 stars 32 forks source link

Getting 404 error #19

Closed sandeep000 closed 4 years ago

sandeep000 commented 4 years ago

I have a test ServiceNow instance: https://dev92517.service-now.com/ I have install Service Now plugin in Jenkins and tried a simple test

pipeline { agent any stages { stage("Create CR") { steps { script { def response = serviceNow_createChange serviceNowConfiguration: [instance: 'dev92517', producerId: 'ls98y3khifs8oih3kjshihksjd'], credentialsId: 'snintegration' println response } } } } }

and I am getting this

Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\ServiceNowIntegration [Pipeline] { [Pipeline] stage [Pipeline] { (Create CR) [Pipeline] script [Pipeline] { [Pipeline] serviceNow_createChange [Pipeline] echo Status: 404 [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS

Could you please help why I am getting 404 error

jmcshane commented 4 years ago

This 404 error looks like it is coming from that producer not being in the service now instance. Are you sure you have a change request producer with the ID provided? I can take a look at how we do error handling here and see if it needs to be updated to provide more granular info

sandeep000 commented 4 years ago

If I omit producerId I get the same 404 error. I am not sure where to get producerId, I am following instruction from readme.

sandeep000 commented 4 years ago

Could you please let me know what is producerId and where should I get one??

jmcshane commented 4 years ago

ok, i looked more closely at this, you just copied the producerID from our readme. Of course you are going to have issues.

This plugin works using the standard change request workflow (and does not yet support creating a change directly from the table API). You can follow this documentation to create a standard change request producer in service now. Then, find the sys_id of the producer that was created and use that in your Jenkins job