{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":38481,"path":"platform-administration/c_OptSpecifyingAdvancedCond.md","title":"Advanced conditions for email notifications","bundle":null,"doc_type":null,"release":"australia","body":"\n# Advanced conditions for email notifications\n\nUse an advanced condition to send a notification based on the current email record, changing field values, or system properties.\n\nTo send a notification using an advanced condition, you can:\n\n-   Call a function that returns a value, or\n-   Set the global variable `answer` using a script\n\nFor example, in the following code, you call a function to prevent the system from sending an email notification if the sender of a self-service request is a member of the XYZ group:\n\n```\n(function() {\n  var groupMember = gs.getUser();\n  return !groupMember.isMemberOf('XYZ');\n})();\n```\n\nAlternatively, you can script the same advanced condition by using the `answer` variable:\n\n```\n\nvar groupMember = gs.getUser();\n  if(groupMember.isMemberOf('XYZ')){\n    answer = false;\n  } else {\n    answer = true;\n  };\n```\n\nNote that the script must set the `answer` variable to **true** to send the notification. If you script no conditionals, the value of `answer` is equal to the last value that you set for the variable.\n\nYou can add a script-based condition in the **Advanced condition** field by configuring the Email Notification form and adding the field. You can access the field in the **Advanced** view without configuring the form.\n\nThe advanced condition script uses the following business rule global variables:\n\n-   current: contains the current record from the table to which the notification is linked.\n-   event: contains the event that triggered the notification.\n\n**Note:** The **Advanced condition** field is evaluated in addition to other conditions you set on the notification. Both the **Condition** and **Advanced condition** must evaluate to true in order to send the notification.\n\n**Parent Topic:**[Create an email notification](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/t_CreateANotification.md)\n\n**Related topics**  \n\n\n[Create an email notification](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/t_CreateANotification.md)\n\n"}}