How to create a Choice / Select box in widget SP

shaik_irfan
Tera Guru

Hi,

 

I want to create Choice type field in widget and add choice values with the values

 

I get the name from the integrations as shown below::

Thailand,Japan,Singapore,Nepal,Malaysia,Canada,Australia,Australia,Australia,Cambodia,Sri Lanka,Germany,Finland,United Arab Emirates,Philippines,India,Italy,Sweden,Spain,Australia,Belgium,Egypt,Australia,Lebanon,Iraq,Oman,Afghanistan,Bahrain,Kuwait,Algeria,Croatia,Switzerland,Austria,Israel,Pakistan,Brazil,Georgia,Greece,North Macedonia,Norway,Romania,Estonia,San Marino,Belarus,Iceland,Lithuania,Mexico,New Zealand,Nigeria,Australia,Ireland,Luxembourg,Monaco,Qatar,Ecuador,Azerbaijan,Armenia,Dominican Republic,Indonesia,Portugal,Andorra,Australia,Latvia,Morocco,Saudi Arabia,Senegal,Argentina,Chile,Jordan,Ukraine

 

Now what ever the names i received i want to display in the choice values. Can anyone please help me on this

3 REPLIES 3

Kunal Varkhede
Tera Guru

Hi,

 

Using option schema you can create Choice type field and add the value in it. 

Go through below the doc it will help you.

https://developer.servicenow.com/connect.do#!/event/creatorcon18/CCW1088/creatorcon_18_CCW1088_1_usi...

 

Thanks,

Kunal

Hi @Kunal Varkhede 

 

I cant create a Option schema because i dont have any table, i am getting a result from an integration, so what ever names i received i just need to add as choice values in the widget

 

 

 

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

You have to create a array in server script and then use ng-repeat in html script as below:

HTML:

<tr ng-repeat="report in data.reports | orderBy:c.sort.sortType:c.sort.sortReverse | filter:c.sort.searchReports">
<td>{{report.number}}</td>
<td>{{report.display_name}}</td>
<td>{{report.producer}}</td>
<td>{{report.director}}</td>
<td style="text-align:right">
</td>
</tr>

 

Server Script:

find_real_file.png

 

Thanks,
Ashutosh Munot