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) )
5
  • What's the problem? Feb 15, 2017 at 10:00
  • Hi Martin, i am confused how to use If conditon in that
    – siddharth
    Feb 15, 2017 at 10:02
  • What's the name of the lookup field related to the lead? Feb 15, 2017 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, 2017 at 10:18
  • I have tried this and its working
    – siddharth
    Feb 15, 2017 at 10:19

1 Answer 1

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) )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .