Need to create a dropdown field in ui page

Community Alums
Not applicable

Please Urgent Requiremnet.......!!!!!!!!!!!!!!!!

Hello everyone,

 
 
I'm new to servicenow, I want to create an ui page with a drop down field.
the drop down will have the user data from user table and click save.
when i select any user and click save then it will redirect to my homepage.
 
Please help me with HTML code and scripts.
 
Thanks in advance.
6 REPLIES 6

Hi,

you can have onChange event on that select option and redirect

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <html>
        <style>
            .color-class
            {
            color:red;
            }
            .color-blue-class
            {
            color:blue;
            }
        </style>

        <p class="color-class">hello</p>
        <p class="color-red-blue">Blue Color</p>

        <g:evaluate jelly="true" object="true">

            var inc = new GlideRecord('incident');
            inc.setLimit(10);
            inc.query();
            inc;
        </g:evaluate>

        <select name="tables" id="selected1" onchange="redirect()">

            <j:while test="${inc.next()}">
                <option value="${inc.number}">${inc.number}</option>
            </j:while>
        </select>

    </html>
</j:jelly>

Client Script:

function redirect(){
    
    var url = '/navpage.do';
    top.location.href = url;
    
}

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Community Alums 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader