- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 08:21 AM
Need a business rule to convert all upper case letters to Proper Case or CamelCase on a field. Right now we are having default value all in Upper case, need to change that (to Proper Case) for reporting and consistency with old data on tables. Any one already written or can help me in writing this business rule. Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 12:24 PM
Create a business rule on both insert & update, and use the method mentioned in the below URL to convert camelCase the value and update it in the GlideRecord.
javascript - Converting any string into camel case - Stack Overflow
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 12:24 PM
Create a business rule on both insert & update, and use the method mentioned in the below URL to convert camelCase the value and update it in the GlideRecord.
javascript - Converting any string into camel case - Stack Overflow
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2019 04:39 AM
Hello Sandeep,
Could you please send me your code for all Upper case letters when user type anything on field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2020 09:11 AM
Doing a little coding ... This will cover PROPER Casing of Names
function capitializeLetter(str, charNumber){
return str.slice(0,charNumber) + str.charAt(charNumber).toUpperCase() + str.slice(charNumber +1);
}
function propereCase(str)
{
var firstPass = str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
var finalStr = firstPass;
var specialStartCases =["Mc","O'","Mac"];
specialStartCases.forEach(function(specialCase){
if (finalStr.indexOf(specialCase)===0){
//to Upper the letter AFTER the specialCase
finalStr = capitializeLetter(finalStr, specialCase.length);
}
});
var hyphenLocation = finalStr.indexOf('-');
if (hyphenLocation > -1){
finalStr = capitializeLetter(finalStr, hyphenLocation + 1);
}
return finalStr;
}
var myText = "williams-brown";
var myTextInTitleCase = propereCase(myText);