How to get the current action name of the form through server script in widget in service portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 10:50 PM
Hi Team,
How to get the current action name of the form through server script in widget in service portal?
Thanks,
Yesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 10:53 PM
Hi,
Have you tried by input.action in server script.
if(input && input.action == 'action_name'){
// add script here
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 11:02 PM
Hi
Yes, I have tried that. I am getting action is undefined.
Thanks,
Yesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 11:10 PM
Hi,
you have to define that action in server side script and in client side.
for example- I have created it for create new incidents
Server script:
data.newIncident = {
issueName: '',
urgency: ''
}
if(input && input.action === 'createIncident'){
createIncident(input.newIncident);
}
function createIncident(inc){
// create incident script
}
Client controller:
api.controller=function() {
/* widget controller */
var c = this;
c.data.action = 'createIncident'; // action name
};
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 11:29 PM
Hi
It is still getting as undefined.
Thanks,
Yesh