Announcement

Collapse
No announcement yet.

Cases and assigned Account

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cases and assigned Account

    hi there,
    we have cases, where many contacts from different acounts are involved.​

    is there any reason, why you can only assign one account (company) to a case (project)?
    and on the other side you can assign many contacts (projectmembers) from different accounts.

    just an idea.. how about to remove this field, and show aditionally the companies of the contacts, which where assigned.
    this would ease the selection of accounts and contacts, remove possible inconsitency and also would work, when you choose in the layout manager to work with contact instead of contacts.

    thanks

    edit:
    wow.. just found out i can tweak the cases in entity manager, and add a n:n relationship to accounts. thats really astonishing!!
    but this new field does not behave like contacts, and i have to manage both (accounts and contacts).
    can this be done with a formula?
    like
    Code:
    $newaccountsIds = list();
    $newaccountsNames = list();
    $accountid='';
    $i=0;
    
    ifThen(entity\isAttributeChanged(contactsIds),
        (
            while(
                array\length(accountsIds)>0,
                    array\removeAt(accountsIds, length(accountsIds)-1);
                    array\removeAt(accountsNames, length(accountsIds)-1);
                )
            );
            
            while(
                $i < array\length(contactsIds),
                (
                    $accountid = record\attribute('Contacts', array\at(contactsIds, $i), 'accountid');
                    array\push($newaccountsIds, $accountid);
                    array\push($newaccountsNames, record\attribute('Accounts', $accountid, 'accountName'));
                    $i = $i + 1;
                )
                
                set accountsIds=$newaccountsIds;
                set accountsNames=$newaccountsNames;
            );
        )
    )​
    Last edited by apn; 04-24-2023, 03:05 PM.

  • #2
    Hi,

    > is there any reason, why you can only assign one account (company) to a case (project)?

    It's logical, the same why opportunities and all other entities are related to one account. Your case is specific, not usual.

    > how about to remove this field

    We don't remove what is already in use.



    Comment


    • #3
      You can create a new entity or new relationships.

      The current design is fine and works for most cases where an Account is a central/root node. Everything is around the account. You have a specific case, hence you need either use custom entities, or relationships.

      If your business is B2C, you need to disable all account fields (remove from layouts).
      Last edited by yuri; 04-24-2023, 02:04 PM.

      Comment


      • #4
        Hi apn,

        You can create your own entities with any possible Relationship types. You can also not use the standard Relationship of Cases and Account (by removing unnecessary fields from Layouts) and create in Administration -> Entity Manager -> Case -> Relationships the Relationship​ you need, for example, One-to-Many (as shown in the screenshot).

        You can read more about Relationships by the link: https://docs.espocrm.com/administrat...#relationships.

        You can also read how to adapt EspoCRM from B2B to B2C https://docs.espocrm.com/administration/b2c/.
        Attached Files
        Last edited by victor; 04-24-2023, 02:41 PM.

        Comment


        • #5
          Originally posted by yuri View Post
          Account is a central/root node.
          Hi Yuri,
          B2B or B2C .. ok

          is there a easy way to change Account from Company template to Person template ?
          so we resolve all hard coded "Account" in many files and Acl, and many other.

          central/root node can be Person type. ?
          I think this resolve B2B, B2C in easy way without loose the out-of-box all feature of Account.


          Comment


          • #6
            Hi apn,

            You seem new and already going for the big complex stuff! That good, another strong coder in the forum.

            Anyway just from my experience, if you do go with B2C link above, I recommend not to follow it and still keep those enable as you will need it in my opinion. Not unless you do a major overhaul to take care of what you disable.

            Personally I use Accounts as a group/company/business/relationship, and I have Contact link to that.

            Comment


            • #7
              hey there, thank you for all the answers. usually one doesnt expect so much activity (..experiences from other projects)

              yuri
              > We don't remove what is already in use.
              you are right. but this can be done by a formula (rule). i just try to think it as simple as possible for my colleagues, to keep the problem as low as possible. because there are always those who sometimes don't take it very seriously with the careness.

              > hence you need either use custom entities, or relationships.
              i will try this way, thnx. will give feedback.

              victor
              > You can also not use the standard Relationship..
              👍 that was the astonishing what i found out after my post, so i had to edit it. espocrm is really something special.
              but i couldnt make accounts behave like contacts, where you can select a primary one.
              thnx for the links, even if the second one is out of question because we do b2b, they will help me to get a deeper understanding of how to use espocrm (and best way is always to start with the interesting topics).

              esforim
              you are right, i stumbled across here recently and just trying to explore the possibilities (when i find some time here and there) and see how I can adapt it to our expectations. my script is really basic and mostly nonsense (don't know how to handle the arrays here, was just hoping someone would see it and say: you're on the right track, try it this way 😅 )

              > Personally I use Accounts as a group/company/business/relationship, and I have Contact link to that.
              thnx for the hint. i have to try it out. will give feedback

              Comment


              • rabii
                rabii commented
                Editing a comment
                if you wish to use same logic for contacts meaning having primary contact and contacts, you need to create two relationships between case and account as below:

                1 - Many-to-One (case - Many-to-One - account) => casesPrimary (Cases (Primary)) - contact (Contact (Primary))
                2 - Many-to-Many (case - Many-to-Many - account) => cases (Cases) - accounts (Accounts)

                and just use same logic applied to contacts to create field with primary select.

            • #8
              I wrote quite long post but then a bad refresh page lost it all. So here is a lazy re-write:

              You can check out the unofficial wiki for some interesting thread: https://github.com/o-data/EspoCRM-Le...nd-Design/wiki
              Your skill level is far greater than mine, so it not basic at all: here my learning failure: https://forum.espocrm.com/forum/gene...crm-and-design

              Recently I play with array, but I can't get it to work easily so I went to with "newbie method" instead, you probably use your fancy "i and -1" formula to get the same result:

              This is using Case entity with multiples Contact linked.

              Code:
              '> ### ', contact.firstName, '\n', contact.middleName, '\n', contact.lastName, '\n',
              ifThenElse(contact.dateOfBirth == null, 'MISSING DATE OF BIRTH',datetime\format(contact.dateOfBirth,"DD/MM/YYYY")), '\n',
              contact.phoneNumber, '\n', contact.emailAddress, '\n', // Contact Date of Birth and Contact Info
              //Contact 2
              '> ### ', record\attribute('Contact', array\at(contactsIds, 0), 'firstName'), '\n',
              '> ', record\attribute('Contact', array\at(contactsIds, 0), 'middleName'), '\n',
              '> ', record\attribute('Contact', array\at(contactsIds, 0), 'lastName'), '\n',
              '> ', record\attribute('Contact', array\at(contactsIds, 0), 'phoneNumber'), '\n',
              '> ', record\attribute('Contact', array\at(contactsIds, 0), 'emailAddress'), '\n',
              '> ', record\attribute('Contact', array\at(contactsIds, 0), 'address'), '\n',​
              The primary is index as "1" so I just use it as using contact.Firstname, whereas the 2nd person is index as "0", so I have to keep using the record\attribute formula.

              But if I have 3 people, I need to do the same thing. I don't understand the "i" formula to achieve same result: $i < array\length(contactsIds). At least I think what this code of yours is trying to do?

              Comment

              Working...
              X