I have a custom entity called "Partner" that contains multiple companies, and each company has a logo field of type (image). Is it possible to display the logo/image in another custom entity called "Direction"? I tried adding a foreign key field, but the logo field doesn't appear in the selection
Announcement
Collapse
No announcement yet.
Display logo on other entity ??
Collapse
X
-
Hi,
what kind of relation have you between Partner and Direction
i don’t know if foreign field work for image.. must check on github
i think you can achieve this with formula, create a same field in Direction, and set value with same value of Partner.
image field is just a ID if a attachement. (certainly)
Comment
-
you will need to create your own custom field and then another custom field (link) to display the company with its logo on the direction entity.Rabii
Web Dev
Comment
-
Hi,
create same "type" of field.. i have choose "image" .. same "name" i have choose picture, you choose logo...
just write this in direction entity formula.
pictureId = partner.pictureId;
it's all
You just need to disable "picture/logo" in detail view edit.. make this field conditionnaly read-only.
There i have see maybe a feature request :
why we can put conditianaly read-only field image.. but not in option
Hope Yuri don't see a "design/conception leak".. for me is wonderfull3 PhotosLast edited by item; 05-25-2023, 11:47 PM.
- Likes 2
Comment
-
Hi rabii,
don't see anithing bad, you help many and i use many your tips or code you post.. i will be happy to partage my "little skill"
there are nothing duplicate with this.
all file you uploade is a attachment, with entityType, entityId... if you make a print-to-pdf, it create a attachment.. then you can "download" this, if you do a "export xlsx", it create a attachement, and de download link is the attachementId.
there are 2 direction :
entity -> attachement
attachment -> entity.
in this case,
Partner have uploaded the Picture.. then there are a attachement : entityType = Partner, entityId=?
if i go attachment.. i can see => entityType = Partner.
the solution here.
Direction.. just "point" to the attachementId of Partner.
No duplicate.
it's like a "C++ pointer" .. oufff old learned programming language in school
Just need, if partner->pictureId change... you must update Direction->pictureId and this is possible with Advanced Pack. (but this is the behaviour of all formula without Advanced Pack or custom code)
Last edited by item; 05-26-2023, 08:53 PM.
Comment
-
item if partner is deleted then formula should help. something like below:
```
ifThen(!partnerId && pictureId,
record\update('Attachmnet', pictureId, 'deleted', true);
entity\setAttribute('pictureId', null);
)
```
This way crm will check if we have a pictureId and no partner then delete the attachment.
-
Here the code I end up using, nothing fancy:
Code:ifThenElse(accountParent.accountsIds==null, , companyLogoId=accountParent.companyLogoId)
Being fancy as him I copy, here update.
Code:ifThenElse( !accountParent.accountsIds && !companyLogoId && accountParent.agreementsIds=='someIDforspecialaccount' &&, , companyLogoId=accountParent.companyLogoId)
Code:ifThen( accountParentId!=null && companyLogoId==null && accountParentId!='special_ID_of_Parent', companyLogoId=accountParent.companyLogoId)
Last edited by esforim; 06-03-2023, 04:52 AM.
Comment
Comment