Charcater Validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2024 09:54 PM
Exclude data patch request using this condition
Change Type IS Emergency
&&
Sub Type IS ONE OF 400 / 500/600
&& service.justification CONTAINS **Eligible**
Minimum Character limit of 100 characters to be introduced for the below sections of the change ticket
Description
Justification
risk and impact analysis
Minimum Character limit of 15 characters to be introduced for the below sections of the change ticket (the limit is kept 15 as at times these details are attached in excel forms)
Implementation Plan
Backout Plan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2024 10:58 PM
Hi @PratikshaAbhang ,
You can write onsubmit client script and use below code.
var description = g_form.getValue('description');
var justification = g_form.getValue('justification');
var ria = g_form.getValue('risk_impact_analysis');
if(description.length <= 100 || justification.length <=100 || ria.length <=100){
alert('Please add at leas 100 character for description,justification and risk impact analysis');
return false;
}
Similarly you can check for "Implementation Plan and Backout Plan" filed for 15 character.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2024 01:29 AM
Hi @PratikshaAbhang - Just write a BR on Change request table on before Insert or before Update with below as sample.
(function executeRule(current, previous /*null when async*/) {
// Check if Change Type is 'Emergency'
if (current.change_type == 'Emergency' &&
(current.sub_type == '400' || current.sub_type == '500' || current.sub_type == '600') &&
current.service.justification.indexOf('Eligible') !== -1) {
// Add logic here to exclude data patch requests
gs.addErrorMessage("This change request is excluded due to data patch conditions.");
current.setAbortAction(true); // Prevents the insertion or update of the record
}
})(current, previous);