Setting a script to run on UI Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2023 07:40 AM
I am working on a UI Page that has two input fields for Fiscal Year and Quarter. From those values, I need to run a script to create child records to a table for a data call. I don't know how to get the call to initiate after the user enters the values and clicks OK. After clicking OK, I want to take the values from the UI Page and either run a script to process the datacall or call a business rule to do the same. Is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2023 07:48 AM
If your UI Page is on a Service Catalog, you will need a Catalog Client Script set to onChange of the field and then pass that data into a GlideAjax script include that can do the data calls you need.
If the UI Page is on the Now User Access Interface, then this can be accomplished with a similar Client Script on the form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2023 07:55 AM
- In the input fields, include an id:
<input id="service_input" class="select2 form-control"/>
- Then for your button, you'll call a client script:
<button id="ok" class="btn btn-primary" onclick="return submitOk(); ">
- Then in the client script you can get that input variable:
var selServe = $j("#selected_service").val($j("#service_input").select2('val'))
- Then in the processing script, you can use selServe (or your vars) to do your server side logic.