The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting CIs to .jsp-file

SOLVED
Go to solution
Highlighted
Stefan Sagstett
Super Collector

Selecting CIs to .jsp-file

Hello...

I customized the CreateServiceCall.jsp a little bit. But now there is a problem for me. I wanted not the user's CIs to be in the pulldown menu to select a Config. Item, but only an amount of before selcted CIs. Therefor I used a Code-field in the CI-Form, that says whether a CI should be presented in the Web or not (filled with Yes||No).

Now I'm not able to find out those CIs and fill them in this pulldown menu.

My approach:
IConfigurationItemHome ci_hm = bean.sd_session().getConfigurationItemHome();
IConfigurationItemWhere ciWhere = ci_hm.createConfigurationItemWhere();
ciWhere.addCriteriumOnCICode11("Yes");
IConfigurationItem confitems[] = ci_hm.findConfigurationItem(ciWhere);

With these lines I wanted to fill confitems, but it doesn't work. No specific error is reported to me.

Could anyone help me with these problem?

Thanks in advance...

Stefan
10 REPLIES
Akies
Occasional Visitor

Re: Selecting CIs to .jsp-file

Hi Stefan,

I did'nt get your question. Do you want to show a drop-down menu to the user where he will get all the CI's list or only those CI's that are attached to him?

Well getting a list of CI's is possible.

Kindly update what u basically want?

Regards,
Akhil
Stefan Sagstett
Super Collector

Re: Selecting CIs to .jsp-file

Hi Akhil,

I'd like to show a drop-down menu to the user where he will get a CI's list that have a "Yes" in the specified Code-field cicode11.
So the list should not contain all CIs and not only the CIs that are related to the users, but all CIs fulfilling the criteria cicode11=yes.

Stefan
Akies
Occasional Visitor

Re: Selecting CIs to .jsp-file

Hi Stefan,

Now I understand this.Can you tell me what kind of value that code field contains?
Does it contains only yes and no? like:

Do you want to select the CI's? (Yes/No)

OR

something else?

Regards,
Akhil
Stefan Sagstett
Super Collector

Re: Selecting CIs to .jsp-file

Hi Akhil,

the field only contains Yes or No, no other values.

Bytheway I took a code-field for that, because no boolean-field was empty anymore. So don't wonder...

Stefan
Akies
Occasional Visitor

Re: Selecting CIs to .jsp-file

Hi Stefan,

If this is the case then I think there was no need to use any bcustom field from SD also unless it is to be used for reporting.
You could use a junk value on the web page.

Anyways, first try to generate a drop-down list of all CI's irrespective of the code value selected.

Once you get it there, then try to use javascripting where you can enable that list part if selected value is Yes.

or you can provide a separate webpage asking only for this question.If answer is Yes then redirect the use to the webpage having CI dropdown list alse redirect him to the simple page.

Hope this helps you.

Regards,
Akhil
Akies
Occasional Visitor

Re: Selecting CIs to .jsp-file

Hi stefan,

Just now I got following javascript from net:

<SCRIPT LANGUAGE='JavaScript'>

</SCRIPT>





You can use it also.

Regards,
Akhil
Gyula Matics_1
Honored Contributor

Re: Selecting CIs to .jsp-file

Stefan,

the problem with your code is that on the where object you need to reference the actual code value, not the text of that value.

so instead of ciWhere.addCriteriumOnCICode11("Yes");

You'll need something like this:

ICICode10Home ci10home= session.getCICode10Home();
ICICode10 ci10yes[] = (ICICode10[]) ci10home.searchOnText("Yes");
ciWhere.addCriteriumOnCICode11(ci10yes[0]);

hope this helps,
Gyula
Gyula Matics_1
Honored Contributor
Solution

Re: Selecting CIs to .jsp-file

11 instead of 10 of course.

ICICode11Home ci11home= session.getCICode11Home();
ICICode11 ci11yes[] = (ICICode11[]) ci11home.searchOnText("Yes");
ciWhere.addCriteriumOnCICode11(ci11yes[0]);

Stefan Sagstett
Super Collector

Re: Selecting CIs to .jsp-file

Hi Gyula,

allright. That was indeed the problem. Now I did it this way and it works !!!

ICodeHome code2Home = bean.sd_session().getCodeHome();

ICICode11Home ciCode11Home = bean.sd_session().getCICode11Home();
ICICode11Where ciCode11Where = ciCode11Home.createCICode11Where();
ciCode11Where.addCriteriumOnText("Yes");

ICICode11[] ciCode11 = ciCode11Home.findCICode11(ciCode11Where);

IConfigurationItemHome ci_hm2 = bean.sd_session().getConfigurationItemHome();
IConfigurationItemWhere ciWhere2 = ci_hm2.createConfigurationItemWhere();
ciWhere2.addCriteriumOnCICode11(ciCode11[0]);
IConfigurationItem cicode2[] = ci_hm2.findConfigurationItem(ciWhere2);
SortCode.sortIObject(cicode2);

Thank you all very much.

Stefan
Stefan Sagstett
Super Collector

Re: Selecting CIs to .jsp-file

Everything is fine now...
//Add this to "OnDomLoad" event