Restrict if any field value starting with apart from 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 11:32 AM
@Ankur Bawiskar @Community Alums @Sohail Khilji @Maik Skoddow ,
Guys please help me
In a field I will be having series number starting with 7*
Example
7456
7869
7789
if field number starting with 7 series then only record should be created if not it should not create any record
help me with the script & where i can achieve this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 11:53 AM
You can use something like
var srNumber = srNumber.toString();
if (srNumber.charAt(0) === '7')
{
//proceed;
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 11:58 AM - edited 06-05-2024 05:08 AM
Hi @ARAVINDA11
You can try the below script OnSubmit
function onSubmit() {
// Replace 'field_name' with the actual field name you want to check
var fieldValue = g_form.getValue('description');
// Check if the field value starts with '7'
if (!fieldValue.startsWith('7')) {
alert('The field value must start with 7.');
return false; // Cancel form submission
}
return true; // Allow form submission
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 12:01 PM
You can use before Business Rule to achieve the functionality.
Script: