AutoComplete with String field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 05:26 AM
We have an existing custom table with a set of values. When the user enters data in the field, it needs to check against the value in the existing table and existing column (same like reference field) and if value is not present, it has to save the new value (same like text field)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 06:15 AM
Can you elaborate on your question or issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 07:51 AM
So consider we have custom table "File Details". We have field as "File Name" where user can select from existing "File Name" (which need to define as self referencing field) and if required file name is not existing, then he can type new name in the same field. Something like self building fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 06:49 AM - edited ‎05-13-2024 06:56 AM
Hi,
there are 2 ways i can think of.
1) You can add this logic in a before insert/update Business Rule. In that BR check if the current data entered is already present or not, and if it is not then you allow it to be inserted.
EG
var rec= new GlideRecord("<table name>");
rec.addQuery("<field name>", current.<field name>);
rec.query();
if (grsim.next()) {
gs.info('<Add Error Message>')
current.setAbortAction(true);
}
2) The field that you are running this logic against, Navigate to the dictionary and make it unique. This way the DB itself will only allow new/unique entries in this field for new rows and will not allow duplicates
EG
PS, if this field is not on the form you may have to bring it by changing the form layout of the dictionary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 08:00 AM
Hi Anurag,
We want to allow user to type new value before inserting record in custom table. Same like select box, if user is selecting Other, then new text box will appear to enter new value.
But we need to achieve by using reference field
Consider we have custom table "File Details". We have field as "File Name" where user can select from existing "File Name" (which need to define as self referencing field) and if required file name is not existing, then he can type new name in the same field. Something like self building fields.