0

I have formula field class name which fetch the mentor first name and last name+ student first name, last name which have lookup related to contact. Now, if student firstname and last name is null then it will fetch lead firstname and lastname which is lookup field related to lead. Here's what I tried so far:

IF( AND ( ISBLANK(Student__r.FirstName),ISBLANK(Student__r.LastName) ), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " + Lead__r.FirstName + " " + Lead__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " +Student__r.FirstName + " " + Student__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate) )
  • What's the problem? – Martin Lezer Feb 15 '17 at 10:00
  • Hi Martin, i am confused how to use If conditon in that – siddharth Feb 15 '17 at 10:02
  • What's the name of the lookup field related to the lead? – Martin Lezer Feb 15 '17 at 10:04
  • IF( AND ( ISBLANK(Student__r.FirstName),ISBLANK(Student__r.LastName) ), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " + Lead__r.FirstName + " " + Lead__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " +Student__r.FirstName + " " + Student__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate) ) – siddharth Feb 15 '17 at 10:18
  • I have tried this and its working – siddharth Feb 15 '17 at 10:19
0

The contact last name is a required field in Salesforce. Your formula is not working because the condition first name and last name are null can't be reached.

So you just have to remove the check on the last name:

IF( ISBLANK(Student__r.FirstName), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " + Lead__r.FirstName + " " + Lead__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate), 'Mentor' + " " +Mentor__r.FirstName + " " +Mentor__r.LastName+" "+ 'and'+" " +'Student'+ " " +Student__r.FirstName + " " + Student__r.LastName + " "+ "-" +" "+ 'class start time:' +" "+Text(CreatedDate) )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.