Hello Everyone.
i have a question. i need to turn the text of two fields in upper case when i update the field.
i have this code but its not working, or if someone have a diferent code to turn the text of string field to Upper Case appreciate.
function UpperCase(){
var FIELDS_TO_UPDATE = ["Nome", "Descrição"]; //Update the field values to your field names
function onLoad() {
setToUpperCase(FIELDS_TO_UPDATE);
}
function setToUpperCase(fields) {
for (var i in fields) {
var str = Xrm.Page.getAttribute(fields[i]).getValue();
var Upper = str.toUpperCase();
Xrm.Page.getAttribute(fields[i]).setValue(Upper);
}
}
}
*This post is locked for comments
I have the same question (0)Hi,
Try to call below method on change of the fields , just replace the filename in below method.
function setUppercase()
{
var str1=Xrm.Page.getAttribute(fieldname1).getValue();
if(str1 !=null)
{
str1 = str1.toUpperCase();
Xrm.Page.getAttribute(fieldname1).setValue(str1);
}
var str2=Xrm.Page.getAttribute(fieldname2).getValue();
if(str2 !=null)
{
str2 = str2.toUpperCase();
Xrm.Page.getAttribute(fieldname2).setValue(str2);
}
}