Refresh record/redirect to current record in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 04:26 AM
Hello,
I have a complex flow that does lots of stuff and in the end there is an UI message.
After the user closes the message, he/she needs to refresh the page in order for a UI action to appear on the form.
UI action's condition: if field x is populated (that field is populated by my flow).
My new requirement is to refresh/redirect to current record after the message appears and the user closes the message. This way, the user doesn't have to refresh the form manually.
What do you think is the best approach to do it?
Thank you,
Elena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 05:11 AM
One approach to automatically refresh the page after the user closes the UI message is to use a client-side script that listens for the "closed" event on the message and then triggers a page refresh. Here's an example of how you can implement this approach:
- Add a client-side script to the form: Add a client-side script to the form that listens for the "closed" event on the UI message. Here's an example of what the script might look like:
function onMessageClosed() {
// Refresh the page
window.location.reload(true);
}
// Listen for the "closed" event on the UI message
var message = g_form.getControl('message_id');
message.observe('closed', onMessageClosed);
- Modify the UI message: Modify the UI message to include a reference to the client-side script. You can do this by adding an onclose attribute to the message that calls the client-side function. Here's an example of what the modified message might look like:
var message = new GlideRecord('sys_ui_message');
message.initialize();
message.type = 'info';
message.message = 'Your message text here';
message.onclose = 'onMessageClosed()';
message.insert();
By following these steps, you can automatically refresh the page after the user closes the UI message, and trigger the appearance of the UI action if the field x is populated.
I hope that may helped
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 06:55 AM
Hey!
Sorry, but I don't get it:
- What type of client script should it be?
- Where do you add the GlideRecord step? instead of calling the UI message in flow?
- Won't the GlideRecord create a new record each time the flow logic will execute?