1

Here's the deluge script to capitalize the first letter of the sentence and make the other letters small that isn't working:

a = zoho.crm.getRecordById("Contacts",input.ID);

d = a.get("First_Name");

firstChar = d.subString(0,1);

otherChars = d.removeFirstOccurence(firstChar);

Name = firstChar.toUppercase() + otherChars.toLowerCase();

mp = map();

mp.put("First_Name",d);

b = zoho.crm.updateRecord("Contacts", Name,{"First_Name":"Name"});

info Name;

info b;

I tried capitalizing the first letter of the alphabet and make the other letters small. But it isn't working as expected.

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • Zoho deluge has a function called proper that returns the string with the first character in each word in upper case, and all other characters in lower case. https://www.zoho.com/deluge/help/functions/string/proper.html – Pestana Feb 08 '23 at 14:39

4 Answers4

0

Try removing the double-quotes from the Name value in the the following statement. The reason is that Name is your variable holding the case-adjusted name, but "Name" is the string "Name".

From:

b = zoho.crm.updateRecord("Contacts", Name,{"First_Name":"Name"});

To

b = zoho.crm.updateRecord("Contacts", Name,{"First_Name":Name});

ZohoCoder
  • 385
  • 5
  • 15
0

Try using concat

Name = firstChar.toUppercase().concat( otherChars.toLowerCase() );
silver
  • 4,433
  • 1
  • 18
  • 30
0

This might help you

sentence = "salsalIn mOoKo sIge NA";
capitilize_first_char_every_word = sentence.proper();
capitilize_only_first_char_of_sentence = sentence.subString(0,1).toUpperCase().concat(sentence.subString(1,sentence.toList("").size()).toLowerCase());


info capitilize_first_char_every_word;
info capitilize_only_first_char_of_sentence;

Info result should be :

Salsalin Mooko Sige Na
Salsalin mooko sige na

You can try this script in https://dre.zoho.com/tryout

von-tastic
  • 81
  • 5
0

Your code put 'd' into "First_Name" but 'd' wasn't cleansed. You also don't need a map as you are updating with the key/value in the update Record. Try this...

Set argument of contactId

contactRec = zoho.crm.getRecordById("Contacts",contactId);

firstChar = contactRec.get("First_Name").subString(0,1);

otherChars = contactRec.get("First_Name").removeFirstOccurence(firstChar);

firstName = firstChar.toUppercase() + otherChars.toLowerCase();

updateContact = zoho.crm.updateRecord("Contacts", contactId,{"First_Name":Name});
Usitha Indeewara
  • 870
  • 3
  • 10
  • 21
Jane
  • 1