glad it worked for you
cheers
Announcement
Collapse
No announcement yet.
Obtaining contacts ids of an account
Collapse
X
-
Thanks for replying. It didn't work, but it helped to figure out.
What I was looking for was just id. I didn't knew id returns current entity id.
So the code needed was that simple:
$contactsIds = record\findRelatedMany('Account', id, 'contacts', 100);
Thank you
- Likes 1
Leave a comment:
-
Best way is to use formula for Account, you can try the code below: go entity Manager and select account and chose formula :
Code:// This should return all count of contacts related to the current account $contactsCount = record\count('Contact', 'accountIds=', id); // This should return the ids of the contacts related to the current account $contactsIds = record\findRelatedMany('Account', accountId, 'contacts', $contactsCount, 'createdAt', 'desc');
cheers
Leave a comment:
-
Hi, we need the contactsIds inside the same Account entity.
There is no contactsIds attribute and if we use "record\findRelatedMany('Account', $accountId, 'contacts', 100);" how we can get the accountId of the same Account?
If we manualy add the accountId number for testing, everything works as expected.
Thanks
Leave a comment:
-
-
-
Obtaining contacts ids of an account
For the relaionshisps among entities you normally have the multiple link field in one entity that relates to the other.
And you could use it [linkname]Ids to retrieve an array in the BPM with all the Ids of the other entity.
For example in the contact entity there is a field called accounts and you can use either accountsIds or accountNames to retrieve all the accounts related to a given contact
But in the entity Account I can´t find the related field contacts.
How can I get in the BPM the contacts ids related to a given account?
Thanks in advanceTags: None
Leave a comment: