Validate input field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 02:56 AM
Hi
I have created a custom table name as badge. I have two field name as Badge type and Bagde number. Badge type is of drop down has value C1 and C2 and Badge number is of text field. When user select type as C1 then user needs to enter value in number field. Suppose user enter A6857. Now when another user select C1 and enter same value that is A6857 then it should throw an error.
How can I validate this ? Kindly help me in this.
Thanks,
Saurabh
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 03:14 AM
Hi Saurabh,
Write a before insert business rule---> add condition as number is same as number--> In action check abort action -->add message as Please enter diffrent number.
Regards
Santosh K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 03:20 AM
Hi Saurabh,
As per your requirement, If one user selects C1 and enter A6857 in number field then you want to restrict other user to create same record ?
If yes then you can write "before" business rule for this, that checks both the values on the batch table.
if it find the values in table record then you can set abort action(true) else allow the user to create record.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 04:08 AM
Hi Gaurav,
Please give me that code to compare current entry with enteritis in table.
Thanks,
Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 04:12 AM
BR:-
When to run - Before Insert
var value1 = current.getValue("Field1");
var value2 = current.getValue("Field2");
var glide = new GlideRecord("table name");
glide.addQuery('column_lable1' , value1).addCondition('column_lable2' , value2);
glide.query();
if(glide.next())
{
current.setAbortAction(true);
}
Please let me know the response.