Announcement

Collapse
No announcement yet.

how to fetch picture field from entity 1 to linked entity 2?

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

  • necro208
    replied
    Originally posted by gustavgraz View Post
    Hello!

    Just wanted to let you know the result: As I still have no FTP access to my system, so I am not able to follow the suggested solution.

    Eymen helped me out with an extension, exactly made for my needs. I hope he can make it happen, that he offers this extension "Foreign Image" in future for the comunity at reasonable cost!

    Thank you Eymem, you made my day!
    Hello !
    I am new here and I have the exact same Probleme.

    eymen-elkum : Is it possible to get your extension somewhere ? That would help a lot

    Thank you in advance

    Necro208

    Leave a comment:


  • eymen-elkum
    commented on 's reply
    I will make it as free extension

  • gustavgraz
    replied
    Hello!

    Just wanted to let you know the result: As I still have no FTP access to my system, so I am not able to follow the suggested solution.

    Eymen helped me out with an extension, exactly made for my needs. I hope he can make it happen, that he offers this extension "Foreign Image" in future for the comunity at reasonable cost!

    Thank you Eymem, you made my day!

    Leave a comment:


  • eymen-elkum
    replied
    Hi gustavgraz ,

    First of all, you need to use "imageId" and not "image"

    I was about to finish the complete formula example before I noticed that this is not the best practice,

    the PROBLEM is if the image in the parent entity changed, then you need one more formula on the parent to loop over the linked entities and update the imageId there.

    I think that your question is general case and many projects will need this feature, so I figured out the best practice for it:

    1 - Go to the entityDefs Json file of the linked entity, in your case:

    custom/Espo/Custom/Resources/metadata/entityDefs/GefaehrlicheArbeitsstoffe.json

    2 - Add this entry to the fields, I prefer to add it just after the defs of your image:

    Code:
    {
        "fields": {
          "pictograms": {
             "type": "image",
             "previewSize": "small",
             "isCustom": true
          },
          "pictogramsId": {
             "type": "varchar",
             "select": {
                "sql": "accountImage.pictograms_id",
                "leftJoins": [
                   [
                      "Gefahrensymbole",
                      "gefahrensymbole_x",
                      {
                         "[COLOR=#c0392b][B]gefaehrliche_arbeitsstoffe[/B][/COLOR].accountId:": "gefahrensymbole_x.id",
                         "gefahrensymbole_x.deleted": false
                      }
                   ]
                ]
             }
          }
       },
       "links": {
          .......
       }
    }
    Please see the below picture, it is for working example, I may mis wrote your entity names in the above example:

    This example aimes to render the account image on the related contacts, I prefer to make the image readOnly

    Click image for larger version  Name:	Screen Shot 2020-09-05 at 10.49.36 AM.png Views:	6 Size:	701.0 KB ID:	62298
    Attached Files
    Last edited by eymen-elkum; 09-05-2020, 04:36 PM.

    Leave a comment:


  • gustavgraz
    replied
    Hi Eymen!

    Thank you for your hint!

    So I did set up a picture field "piktogramm" in entity 2 "Gefaehrliche Arbeitsstoffe" and used the formula:

    piktogramm = gefahrensymbole.piktogramm

    Cleared cache in EspoCRM and browser.

    Unfortunately does not work...

    Leave a comment:


  • eymen-elkum
    replied
    Have you tried the formula?

    Try to add normal image field to the entity 2, and in the formula read the imageId of the related entity1 and set to the local image Id on entity2

    Leave a comment:


  • how to fetch picture field from entity 1 to linked entity 2?

    Advanced Pack 2.5.14
    EspoCRM VErsion 5.9.3


    Hello!

    I have two custom entities.

    entity 1: Gefahrensymbole
    It has a list of hazard pictograms. The pictograms are uploaded using a "picture field".

    entity 2: gefaehrliche Arbeitsstoffe
    Every record in entity 2 should have a field with the pictogram out of entity 1.

    Link entity 2 to entity 1 is n:1

    Problem:
    If I try to set up a foreign field "piktogramm" in entity 2, using the link "Gefahrensymbole" there is no field "Piktogramm" to choose.

    Is there a workaround to get the picture fetched into the records of entity 2 or is there a different way to do it?

    Thank you!


Working...
X