Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Dropdown options required in portal

thaduri sai
Tera Contributor

Hi Team,

 

We have added popup free text field message in portal - and now we need dropdown field with 3 options instead of free text field.

 

thadurisai_0-1706869111320.png

 

How to acheive it ?

 

Thanks,

Sai

 

4 REPLIES 4

AnveshKumar M
Tera Sage

Hi @thaduri sai 

 

You can try the following script.

 

<g:ui_choice_input_field id="choice_list_id" name="choice_list_name" label="Select Option">
      <option value="">--None--'</option>
      <option value="1">Option 1</option> 
      <option value="2">Option 2</option>
      <option value="3">Option 3</option> 
</g:ui_choice_input_field>

 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Anvesh

@AnveshKumar M , Thanks for your help.

 

We are return this below CSS in widget - Can you please modify this below script. 

 

$scope.escalateIncident = function() {
        spModal.open({
            title: 'Please confirm if you want to reopen this incident.',
            message: 'Please enter reason for re-opening this incident:',
            input: true,
             buttons: [
                {label:'✘ ${No}', cancel: true},
                {label:'✔ ${Yes}', primary: true}
            ]
        }).then(function(name) {
        $scope.data.escalateIncident = name;
        $scope.data.action = 'escalateIncident';
        $scope.server.update(init).then(function(response){
                    if (response.isIncidentResolved)
                        spAriaUtil.sendLiveMessage(c.reopenedIncidentMsg);
                });

Not applicable

Hi,

 

Did you find a way to create dropdown field if so can you please share me the script

JamesPiveta
ServiceNow Employee

I know this is an old question, but the answer might be useful to someone. You can call a widget to be displayed inside the modal, using the parameters 'widget' (ID of the widget to be called) and 'widgetInput' (object with values). In the widget, you can create your dropdown menu or any other logic you need.

 

//Client script
function(spModal) {
  var c = this;
  c.onWidget = function() {
        spModal.open({
            title: 'title',
            widget: 'widget-cool-clock', 
            widgetInput: {'variable1': 'value1', 'variable2': 'value2'}
        }).then(function(){
            console.log('widget dismissed');
        })      
    }
} 

 https://www.servicenow.com/docs/r/api-reference/SPModal-API.html