Account Inactive
Collapse
X
-
Currently by writing `id = something` it's possible to break something. So it's better it to be not available in suggestions for now until there's some measure not allowing this. -
Yuri - thanks for this.
This was on the Contact record, so the actual line of code that I used was:
Code:record\updateRelationColumn('Account', accountId, 'contacts', id, 'isInactive', true);
Leave a comment:
-
You need to find the id of the account you wish to set contact as inactive on. i think something like code below could achieve this.
Code:// Find the account first using name or id or whatever filter you wish $accountId = record\findOne('Account', 'createdAt', 'desc', 'name=', 'youraccount'); // loop through the record and just update the given found index $i = 0; while( $i < array\length(accountsIds), ( $index = array\indexOf(accountsIds, $accountId); ifThen($index, record\updateRelationColumn('Account', $accountId, 'contacts', id, 'isInactive', true) ); $i = $i + 1; ) );
-
The last example is what you need except instead of 'role' use 'isInactive'. https://docs.espocrm.com/administrat...relationcolumn
true/false are correct values.
record\updateRelationColumn('Account', $accountId, 'contacts', $contactId, 'isInactive', true);
Assuming variables $accountId, $contactId are set with IDs.
This was on the Contact record, so the actual line of code that I used was:
Code:record\updateRelationColumn('Account', accountId, 'contacts', id, 'isInactive', true);
Leave a comment:
-
The last example is what you need except instead of 'role' use 'isInactive'. https://docs.espocrm.com/administrat...relationcolumn
true/false are correct values.
record\updateRelationColumn('Account', $accountId, 'contacts', $contactId, 'isInactive', true);
Assuming variables $accountId, $contactId are set with IDs.Leave a comment:
-
Yuri - thanks for the clarity.
When I want to userecord\updateRelationColumn(ENTITY_TYPE, ID, LINK, FOREIGN_ID, COLUMN, VALUE)
When I look in Entity Manager for Contact it just shows as a Many to Many relationship with Account. I am guessing this is implemented as an intermediary table, and that the flag I need lives on that Intermediary table.
So some questions for you:- What is the ENTIRY_TYPE - I am guessing it is the intermediary table that sits between Contact and Account, but I don't know the name
- What ID do I use? I am guessing that there is a link on the Contact to the intermediary table
- What is the "LINK"?
- What is the FOREIGN_ID
- COLUMN = "isInactive"
- What VALUE do I use? 0 or false?
Leave a comment:
-
You can use record\updateRelationColumn function to set the account inactive. The column is named "isInactive".Leave a comment:
-
Hi lazovic thanks for the feedback. I agree completely. What I want to do, is what you have described, but in script.
When I look at Contact within script, there is an attribute called "Account Inactive" which I have tried to clear or set, but it makes no difference.
So my 2 questions above stand:
* What that attribute is for?
* How I set the account as Inactive?
ThanksLeave a comment:
-
Hi MatLudlam,
The name of this attribute speaks for itself, in fact.
1. Go to any test record of the Contact entity type and select a test Account in edit mode.
2. Click on the small triangle next to the Account name to set the Account attribute to Inactive. You will see that the name of the Account is crossed out, which means that this Account is inactive for this Contact.
3. Save the changes and go to the record of this Account, in the Contacts bottom panel you will still see the previously used Contact. But if you set the display in the list of only Active Contacts, it will not be there.Leave a comment:
-
Account Inactive
Hi, in BPM I am working on a Contact (who has left their company) and I want to set the Account as inactive.
There is field called "AccountInactive" but setting it, or clearing it makes no difference.
Can you explain:
* What that attribute is for?
* How I set the account as Inactive?
ThanksTags: None
Leave a comment: