Based on Names we need to get id

Based on Names we need to get id

I have a form named as " contact"  i have field " client name"

if i gave client names as  "Ashok Kumar" then client id must be as " AK-1",
     2) Arjun Kumar - AK-2 
    if the first letters are same the number should be increased like ws-1,ws-2,ws-3 if not it should be in the format XX-1


Below I have attached  a screenshot of contact report  i need an output in this format  SS-1,SS-2,KJ-1 , but i got the output as SS-1,SS-2,KJ-3

 

Here is the code which i have tried, but i am not getting the expected output.


firstVal = input.Lead_Name.getprefix(" ").subtext(0,1);
lastVal = input.Lead_Name.getsuffix(" ").subtext(0,1);
stringval = (firstVal + lastVal).toUppercase();
contactObj = Contact_Form[ID != null];
checkPreffix = Contact_Form[Client_id == stringval];
//collection
if(contactObj.count() == 0 && checkPreffix == checkPreffix)
{
idVal = stringval + "-" + 1;
//info idVal;
}
else if(contactObj.count()>=1)
{
contactsObj = Contact_Form[ID != null].Client_id sort by Added_Time desc;
val = contactsObj.getsuffix("-");
temp = val.toLong();
temp = temp + 1;
idVal = stringval + "-" + temp;
info idVal;
}



      • Sticky Posts

      • How to Add Users to your Organization in ZohoMail?

        A better clarity so you can create other users to start using Zoho Mail. You can directly Add Users from the Control Panel to your Organization. You can invite users with the existing email address. If the person (user) already uses ZohoCRM, then you can import users from Zoho CRM. You can also import them using a .csv file. (if you are planning to add them in Bulk)  In this topic, We will be discussing on how to Add and Invite users only.  The Import options are self explanatory. ____________________________________________________________________________________________________________