- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2022 02:55 AM
Requirement: In the portal there is an application menu on the header whenever I click on that menu it should redirect to other URL and they will send response through payload that menu items need to display in application menu.so,I have created a flow action to get a response from the URL, now I want to call this action in server script of portal menu and should align menu items here from response. Can anyone help me with the script.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2022 03:06 AM
Hi,
Open the action in Flow Designer, click on the button in the top right corner ".." then click on create code snippet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2022 03:06 AM
Hi,
Open the action in Flow Designer, click on the button in the top right corner ".." then click on create code snippet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2022 10:22 AM
Hi,
Thank you for the information. I am trying below script, but it is not working. I am not able see the application menu itself in the portal. After saving this script.Could you please help me on this.
(function() {
var menu_id = $sp.getValue('sp_rectangle_menu'); // instance sys_id
var gr = new GlideRecord('sp_instance_menu');
gr.get(menu_id);
data.menu = {};
data.menu.items = $sp.getMenuItems(menu_id);
var response_body;
try {
// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
// sn_fd.FlowAPI.getRunner().action('global.bt__menunav_api').inBackground().run();
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().action('global.bt__menunav_api').inForeground().run();
var outputs = result.getOutputs();
// Get Outputs:
// Note: outputs can only be retrieved when executing synchronously.
var response_body = outputs['response_body']; // String
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
var menuNavObj = JSON.parse(response_body);
//var sideNavObj = JSON.parse(sideNavVal);
data.sideNavMenuArr = menuNavObj.result.data.menu;
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2022 11:03 PM
Sorry, I'm not very good at Service Portal. Hopefully someone else can pick up the thread.
Or you can ask another (more specific) question.
As far as I can help, I gave you the answer on how to call a Flow action through script.