and more in a single search tool across platforms. Read the announcement here. |
07/14/2022 03:44 AM
Hi Team,
In Salesforce out of the box coonector we are updating community nickname in the format of users's firstname.lastname.employeeid . community nickname limited to 40 characters so if firstname.lastname.employeeid combination exceeds 40 characters then the attribute will not be updated.
Can we acheive this by adding length condition in the json? If firstname.lastname.employeeid exceeds 40 characters print only firstname.lastname
Regards,
Varshita
07/14/2022 04:45 AM
Hi @Varshi_Balaji ,
Yes you should be able to use ternary operators along with methods like length to do this calculation.
Example : "CommunityNickname": "${user?.email.substring(0,user.email.lastIndexOf("@"))}",
07/14/2022 04:53 AM
Hi Sahaj,
I used length in the json, but it gave me not supported.
This is the below json
"CommunityNickname": "${if((user.departmentNumber!=account.customproperty23.substring(3,5) && user.customproperty30!=account.customproperty27)|| user.employeeid.contains('_OLD_')||user.customproperty9=='Terminated'|| user.customproperty21=='As soon as possible') || length({user.firstname.toString()+'.'+user.lastname.toString()+'.'+user.employeeid})<40 {user.firstname.toString()+'.'+user.lastname.toString()+'.'+user.employeeid+'_'+Calendar.getInstance().getTime().format('yyyyMMdd')} else {user.firstname.toString()+'.'+user.lastname.toString()}}"
Regards,
Varshita
07/14/2022 05:19 AM
Hi Varshita,
That is not how length() method is supposed to be used. Its used as :
somestringstoringvariable.length()
07/15/2022 02:56 AM
Hi Sahaj,
We tried in this format also (user.firstname.length() > 40), I'm getting error length is not supported.
Reagrds,
Varshita
07/15/2022 03:00 AM
Hello,
It would help if you post the json you are using along with the provisioning logs.
07/15/2022 03:02 AM
Hi Sahaj,
Below is the modify account json, will post the logs in sometime.
{
"Alias": "${user.firstname.toString().substring(0,1)}${user.lastname.toString().substring(0,3)}",
"Email": "${user.email}",
"FirstName": "${user.firstname}",
"LastName": "${user.lastname}",
"TimeZoneSidKey": "Europe/Paris",
"LocaleSidKey": "fr_FR",
"LanguageLocaleKey": "FR",
"Area__c": "${user.customproperty35}",
"Branch__c": "FR${user.departmentNumber}",
"Street": "${user.locationdesc}",
"Zone__c": "${user.customproperty33}",
"PostalCode": "${user.regioncode}",
"City": "${user.city}",
"Job_Title_Payroll__c": "${user.customproperty27}",
"Username": "${if((user.departmentNumber!=account.customproperty23.substring(3,5) && user.customproperty30!=account.customproperty27)|| user.employeeid.contains('_OLD_')||user.customproperty9=='Terminated'|| user.customproperty21=='As soon as possible'){user.email+'.everest'+'_'+Calendar.getInstance().getTime().format('yyyyMMdd')} else {user.email+'.everest'}}",
"CommunityNickname": "${if((user.departmentNumber!=account.customproperty23.substring(3,5) && user.customproperty30!=account.customproperty27)|| user.employeeid.contains('_OLD_')||user.customproperty9=='Terminated'|| user.customproperty21=='As soon as possible')||(user.firstname.length() > 4 ) {user.firstname.toString()+'.'+user.lastname.toString()+'.'+user.employeeid+'_'+Calendar.getInstance().getTime().format('yyyyMMdd')}}",
"FederationIdentifier": "${if((user.departmentNumber!=account.customproperty23.substring(3,5) && user.customproperty30!=account.customproperty27)|| user.employeeid.contains('_OLD_')||user.customproperty9=='Terminated'|| user.customproperty21=='As soon as possible'){user.email+'_'+Calendar.getInstance().getTime().format('yyyyMMdd')} else {user.email}}",
"TECH_ExternalKey__c": "${if((user.departmentNumber!=account.customproperty23.substring(3,5) && user.customproperty30!=account.customproperty27)|| user.employeeid.contains('_OLD_') || user.customproperty9=='Terminated' || user.customproperty21=='As soon as possible'){'FR'+user.employeeid+'_'+Calendar.getInstance().format('yyyyMMdd')} else {'FR'+user.employeeid}}",
"DeactivationDate__c": "${if(user.employeeid.contains('_OLD_') || user.customproperty9=='Terminated' || user.customproperty21=='As soon as possible'){user.enddate.format('yyyy-MM-dd')}else {Calendar.getInstance().getTime().format('yyyy-MM-dd')}}",
"IsActive": "${if(user.customproperty29=='1'){true}}"
}