Service Desk Practitioners Forum
cancel

Getting and setting Custom Fields in Web API

SOLVED
Go to solution
Highlighted
Envoy2064
Respected Contributor.

Getting and setting Custom Fields in Web API

Hi, I have created a Custom field (drop down field with several options) as an "Entity Reference" under Configuration Items (did it through Administrator Console). I've been pouring through the Web API Javadocs but could not find a way to fetch a custom field belonging to a given Configuration Item (am successfully able to use Web API to find any particular CI I want and open it, but not retrieve its custom fields). Can anyone tell me how I can accomplish this?

Any help will be appreciated.
8 REPLIES
George M. Meneg
Acclaimed Contributor.

Re: Getting and setting Custom Fields in Web API

Hello,

You need to generate Web-Api in order to include your custom fields. To do that:

1. Open Administrator Console
2. Select File/Generate Web Api...
3. Select a Folder for the export and press "Start Generate"

You can find the necessary java files at \web-api\api-client\src\com\hp\itsm\api\interfaces\
menes fhtagn
Envoy2064
Respected Contributor.

Re: Getting and setting Custom Fields in Web API

I did what you have directed, but could not find an Interface or Class with the same name or even contains the field name of my custom field (let's call it "MyField"). I've searched for "MyField" in all the folders generated by the HPSD Admin Console...
George M. Meneg
Acclaimed Contributor.

Re: Getting and setting Custom Fields in Web API

Hello,

Open IConfigurationItemHome.java and IConfigurationItemWhere.java and you are going to find the field there.
menes fhtagn
Envoy2064
Respected Contributor.

Re: Getting and setting Custom Fields in Web API

Hm, I did that, and there is no text with string "MyField" in the IConfigurationItemHome.java or IConfigurationItemWhere.java...almost as if Administration Console web-api generator skipped my custom field while doing its work...
George M. Meneg
Acclaimed Contributor.

Re: Getting and setting Custom Fields in Web API

Hello Again,

I suppose that you activated one of the custom code fields. In that case the field is already there, named CiCodeXX (where XX is a number)
menes fhtagn
Envoy2064
Respected Contributor.

Re: Getting and setting Custom Fields in Web API

Hi, yes I have activated one of the Custom Code fields, but it doesn't show which number it is because I customized the name too, to "MyField", so when I click on that field under "Custom Fields" screen, it doesn't show the number...
George M. Meneg
Acclaimed Contributor.
Solution

Re: Getting and setting Custom Fields in Web API

Hello again,

The simpler way to find it is to go to Presentation/Forms/Configuration Item and open a form. If the field is not in the form drag it to insert it. Then right click on the field and select "Rename". A form will be opened and at the "Key" field you will find the information you want.
menes fhtagn
Vasily Kamenev
Acclaimed Contributor.

Re: Getting and setting Custom Fields in Web API

HI
Are you activate or create CF? This is difference, because if you activate the Code 6, example, so need use CiCode6, if you create so need use "Field Key" value, name of field doesn't matter for api interface.

Vasily