How to test the "name" field in an entity which has First Name and Last Name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murugappan
    Active Community Member
    • Aug 2017
    • 467

    How to test the "name" field in an entity which has First Name and Last Name

    Hi,

    I am facing one problem when i use the formula. I have an entity of the type Person which has the First Name and Last Name. In the formula for the entity when i test "name" field it does not seem to work.

    How do i test the name of the person without having to test First Name and Last Name separately?
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    I don't think it possible since the Name need to be saved first before it get generated.

    (Only Theory here): I suppose you can do multi stage by (1) forcefully generate the name by doing a concatenation, or (2) instead of testing by name, test by First Name & Last Name

    Comment

    • murugappan
      Active Community Member
      • Aug 2017
      • 467

      #3
      esforim

      Unfortunate the case is not as you have assumed. The field is from another entity which has already been created. The following is the formula in the Policyplan entity trying get the id key field for the entity called Policyholder which already has the field name created in the records:

      PHP Code:
      ifThen(ppnPolicyholdername != NULL,
               policyholderId = record\findOne('Policyholder', 'name', 'desc',
                    'name=', string\trim(ppnPolicyholdername));
      );

      Comment

      • yuri
        Member
        • Mar 2014
        • 8442

        #4
        This works:

        Code:
        $id = record\findOne('Person', null, null, 'name=', 'John Smith');​
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment


        • murugappan
          murugappan commented
          Editing a comment
          Hi yuri thank you for the update. I will try it. We have decided to use the base-plus type instead of the Person type. Most of the info supplied to us does not come in proper format. We found using the base-plus much easier. However I will try your advise separately .
      Working...