
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 05:29 AM
Hope you are all safe and well.
I am looking for a recommendation on how to achieve the following.
We have added the email_id field to the customer_account form, which service managers need to populate with a vilid domain, so if the company email is fred.lundy@xyz.com, they would add xyx.com as the field value (without the @). That bits easy! Now, some companies will have multiple email domains, so whats the best way of adding multiple emails to a string field?. Also, we need to create a rule which would then check the value to ensure its a unique domain, both in the string and across all accounts in the table.
Or is there another field type which would achieve this? I did try creating a list field referencing the sys_user table, which gives you the additional box to add a manual email. This would be perfect except it doesnt recognise xyz.com as a valid email.
All advice welcome, thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 07:50 AM
There are several options I can think of
1 - creating a table to store the domain values then create an M2M table that links the values to the records you want them on. Set the field for the domain to be a floating reference so records can be created on the fly and you can set a script/BR to prevent dups in the domain field. You can then add it as a related list either embedded on the form or at the bottom.
2 - Use a Name-value pair field and another field to add values. So it would be like work notes, enter some text in field Add Domain, then check it against the other fields and if its good then add it to the name-value pair field. I have not used one yet but it may work
https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/field-administration/reference/name-value-pair-scripting.html
3 - Use a List field and a table to store the domain names, but I do not think this will work because you will need it to be a floating reference and I do not think that is supported for a List field. You would have to mess with it and see.
4 - Do some fancy script work with concatenating strings into a format and storing it in a text box but thats supper messy to me.
5 - Create a UI Macro for a custom interface and combine that with option 2 for storing the values and you will have something that works but will take some time to build.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 05:34 AM
hey Cirrus,
refer below thread might help you,
kindly mark Correct and Helpful if applicable.
Regards,
Indrajit.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 06:02 AM
Thanks Indrajit. I had read some of these prior to posting, but they appear to be referencing another table or a script to populate the string from another source. The issue I have is that emails domains will not be referenced from another table or source, they will just be added as and when the service manage is aware of an update.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 07:50 AM
There are several options I can think of
1 - creating a table to store the domain values then create an M2M table that links the values to the records you want them on. Set the field for the domain to be a floating reference so records can be created on the fly and you can set a script/BR to prevent dups in the domain field. You can then add it as a related list either embedded on the form or at the bottom.
2 - Use a Name-value pair field and another field to add values. So it would be like work notes, enter some text in field Add Domain, then check it against the other fields and if its good then add it to the name-value pair field. I have not used one yet but it may work
https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/field-administration/reference/name-value-pair-scripting.html
3 - Use a List field and a table to store the domain names, but I do not think this will work because you will need it to be a floating reference and I do not think that is supported for a List field. You would have to mess with it and see.
4 - Do some fancy script work with concatenating strings into a format and storing it in a text box but thats supper messy to me.
5 - Create a UI Macro for a custom interface and combine that with option 2 for storing the values and you will have something that works but will take some time to build.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 09:26 AM
Thanks Drew, I think we may have to give in and go for a list field referencing a custom table