UI Action Redirection for form and list acion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 04:13 AM
Hi All,
I have a requirement as below,
I want to use one UI for both form and List. But when i click the UI action in form it should redirect me to different page when i click in list it has to redirect me to different page. How to achieve this in one UI action. Please help me. Basically it has to identify where the button clicked and based on it has to redirect me.
Help would be appreciated.
Thanks,
malaisamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 05:46 AM
You might be able to use this, depending on what else you need to do. There might be a better way, but this was one way I was able to differentiate.
In the client function, build logic around typeof rowSysId == 'undefined'.
function identifyLocation() {
if (typeof rowSysId == 'undefined') {
// THIS SECTION WAS FOR THE LIST ACTION
} else {
// THIS SECTION WAS FOR THE FORM ACTION
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 10:14 PM
Hi Justin,
Thanks for the reply . If i do this through client function where would i be able to write my server side script which exactly does the action?
Please provide me some sample UI action script which runs in both form and list.
Thanks,
Malaisamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 10:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 05:04 AM
To do what I did, you'll need to check the Client field and put identifyLocation(); in the client function call field.
This is a good reference on how to include both client and server side code in one UI Action: https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
