select modal option and direct user to record producer

DreDay3000
Giga Guru

Hello, I have created a modal with options. When a user selects one of the options and clicks the "create" button the user should be directed to a record producer . Is there a way to achieve this? Thanks.

 

DreDay3000_0-1713891692369.png

 

2 REPLIES 2

Community Alums
Not applicable

Hi @DreDay3000 ,

Create Building is a UI Page ? If yes than you can create a on-click function on create button and  do window.location(url) 

 

Please mark my answer correct and helpful if this works for you 

 

Thanks and Regards 

Sarthak

what I have is done in the ui action

 

function showPage(){

   var gm = new GlideModal('building_ui');
   //Sets the dialog title
   gm.setTitle('Create Building');
   //Set up valid custom HTML to be displayed
   gm.renderWithContent('<div style="padding:15px"><p>What location type would you like to create?</p><p><select name="building" id="buildingCreation" class="form-control"><option value="closeModal" role="option">Create Building</option><option value="createRegion" role="option">Create Region</option></select></p><div style="padding:5px;float:right"><button style="padding:5px;margin-right:10px" onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())" class="btn btn-default">Cancel</button><button style="padding:5px" class="btn btn-primary" onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())">Create</button></div></div>');

}
   
window.changeTaskAction = function(closeModal, thisAction){

      //Close the glide modal dialog window
      gm.destroy();


    //    Submit to the back-end
       if(thisButton=='closeModal'){
          if(thisAction=="cancelAll"){
             g_form.setValue('state',4);//Closed Incomplete -- will close the Requested Item and all other open tasks
          }else{
             g_form.setValue('state',7);//Closed Skipped -- will only close this task
          }
          //Regular ServiceNow form submission
          gsftSubmit(null, g_form.getFormElement(), 'cancel_sc_task');
       }
   
   return false;//prevents the form from submitting when the dialog first load
};