Prefix to single line text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 05:44 AM
Hi Team,
I want to set prefix called (DG - ) followed by the distribution group name which is single line text field how to set it if user removes it and tries to submit form it won't let them until it begins with (DG -) since i have tried using default value using that i am able to submit the form by removing DG .
Please anyone could help me .
Help will be much appreciated !!
Thank You !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 06:05 AM
Hello @Snehal ,
Create an Onsubmit client script on required table to check the value that single line text field start with "DG - " and update it as per your requirement:
function onSubmit()
{
var dgField = g_form.getValue('field_name');
If(dgField.toString().indexOf("DG -") > -1) // you can also used condition that dgField "starts with" "DG -" instead of this if it not works.
{
return true;
}
alert("Please add value in dgField that starts with "DG -"");
return false;
}
If my solution helps you any way then mark it as accepted and helpful.
Thank You!!
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 06:05 AM
Use an onBefore business rule on the table (insert/update) with this script:
(function executeRule(current, previous /*null when async*/) {
// Check if the name starts with "DG - "
if (!current.name.startsWith('DG - ')) {
gs.addErrorMessage('The group name must start with "DG - ".');
current.setAbortAction(true);
}
})(current, previous);
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark