- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 12:11 PM
Hi to everyone.
I'm trying to create a script client that emits an alert when the availability field record changes to reserved.
Can someone help me?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var dis = g_form.getValue("availability");
if (newValue == "reserved") {
alert("Reserved room");
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 03:36 PM
Hi Lidi2115,
onChange() script is executed when the end-user opens the form or when the form is opened. It won't execute after the form is closed. That is, if the form is closed and flow designer changes the field, onChange() script won't execute.
If there is a need to get notified when a value is changed in Flow Designer, use notification to send email or send a message.
There is a "Send Notification" step in Flow Designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 09:34 AM
Hi Hitoshi,
The script only works if I change the availability field manually.
Both your script and others suggested by other colleagues.
Do you have any suggestions of what I can do?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 05:38 PM
As I've suggested, alternative is to use SMS notification to show an alert on the user's web page at the top in the menu that user can select to see the content.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2022 06:53 AM
Hi,
Below Script should work, if still not working you have to validate some points
1) if you want this pop up on Portal UI Type - Should be all in client script so pop will reflect on portal also,
2) Check dis Value in alert, then use that value in if (dis == "value") as there may be a chance backend value is different
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var dis = g_form.getValue("availability");
alert(dis); // for checking value in dis
if (dis == "reserved") {
alert("Reserved room");
}
}
Kindly mark correct and helpful if applicable