- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 12:18 AM
I have created a email notification script in parent table and when i tried to add or remove any variable, it is reflecting in all email notification (child table). But when the child table do not contain the variable which i newly added is showing as "undefined" in notification.
I don't want this to be happen. How to display a particular variable when condition satisfies.
for example:
1. i have "number" and "contact" variable in email script which is created under parent table .
2. But i newly add "description" variable which is not present in all child table form , so will be show "undefined"
3. Basically i want to see "description" variable only based on condition (only when form contain the field and if there is not field found in case/incident created ,then it should be hidden rather than showing as "undefined")
How to achieve this, Can someone help me on this.
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 12:29 AM
Hi Buddy,
For normal fields we can use hasField() method to confirm if the field exist but it doesn't work for variables so what you can do is, in the email script try something like below
if (current.variables.var_name) {
// The variable exists and is not null
} else {
// The variable does not exist
}
Reference: script to check if a variable exists
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 12:29 AM
Hi Buddy,
For normal fields we can use hasField() method to confirm if the field exist but it doesn't work for variables so what you can do is, in the email script try something like below
if (current.variables.var_name) {
// The variable exists and is not null
} else {
// The variable does not exist
}
Reference: script to check if a variable exists
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2022 04:39 AM
@Muhammad,
The above code is working fine but the values in that field is not displaying in email notification.
How to display the value entered in that field.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 12:30 AM
Hi,
You can utilize email script to validate if a value is empty or not:
Aman Kumar