Restrict the use of particular mail id in a field

suuriyas
Tera Contributor

HI Community,

 

I have a requirement, in incident form we have a field called additional assignee list which is list type and reference to user table.

In this field i want to restrict the use of particular mail id let say xx@gmail.com users should not able to enter this particular mail id in that field 

How can we achieve this?

suuriyas_0-1750312413028.png

Note: we don't have any users profile with this mail id but we can able to enter it using highlighted box (add email address)

 

Thanks in Advance

9 REPLIES 9

J Siva
Tera Sage

Hi @suuriyas 
To prevent users from adding email addresses, add the following attribute to the dictionary entry 'Additional Assignee List'. This will hide the email address field.

JSiva_0-1750312980143.png

Regards
Siva

 

suuriyas
Tera Contributor

HI @J Siva ,

 

Thanks for the response

Adding no_email=true; Will it restrict adding all the email id's? because i want to restrict only one mail id in this field.

let say xx@gmail.com only this needs to be restricted 

@suuriyas If I'm correct, you don't want users to add any external email IDs (i.e., those not belonging to the organization). If that's the case, please proceed with the approach I shared. If someone needs to add the email IDs of actual employees, they can use the reference field to select the user

Community Alums
Not applicable

Hello @suuriyas 

 

Please create an on-change client script on additional assignee field.

This is how your script would look like:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var watchList = g_form.getValue('watch_list');
    if (watchList.includes('test@test.com')) {
        alert('test@test.com is not allowed in the Watch List.');
        var emails = watchList.split(',');
        emails = emails.filter(function(email) {
            return email.trim() !== 'test@test.com';
        });
        g_form.setValue('watch_list', emails.join(','));
    }
}
I've used test@test.com as an example.
 
Please let me know if you need any further help.
Please mark answer as helpful/correct if it helps.
 
Best Regards,
Brahmjeet