This script is specifically for builds 10.6 and above
Usecase : Organizations don't want to handle/fetch unapproved contacts mails into the application. They also want to notify the end user when they send email stating-> "The Request raised by you is rejected. Kindly send mail from the registered email."
Solution:
You need to add the attached script in the Request Custom Function in the UI and to create a Business Rule as explained below.
1) Request Custom Function:
Admin -> Request Custom Function
->Name the function. (In the snapshot its mentioned as Negate Request. You can name it as per convenience)
->Add the attached script in this empty space.
->You need to enter out going mail id (that is mentioned in the Mail server settings) in the first line of the script instead of FROM MAIL ADDRESS.
-> Save it.
2) Creating a Business Rule:
Admin -> Business Rule
-> Name the rule
-> Select "Execute on actions as Created"
-> Follow the snapshot to fill in the other details.
-> Action: Select the Custom Function: Fill in the name of the Request Custom Function -created
-> Update the Business Rule.
3) In the Self Service Portal Settings:
Admin -> Self Service Portal
Click on the Requesters & Technicians tab as shown below.
Select on the Add Unknown User As - Unapproved Users as shown in the below snap shot.
Refresh the setup and now when an unapproved contact raises a ticket, ticket will not be created and a auto reply will be sent to him stating "The Request raised by you is rejected. Kindly send mail from registered email".