Issue with image field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 3rdtec
    Junior Member
    • Sep 2020
    • 10

    Issue with image field

    Hi, I need to show different images depending on the value of a field. I created a workflow to check the value of a field and replace the image value using the instruction:

    Ex.
    imageId = '62d92ea2194668b23';

    The images are correctly uploaded to the "upload" folder but when the control field condition changes and therefore the "imageId" value changes, one of the images (the one that is replaced) is physically deleted from the upload folder.

    Ex.

    ifThenElse (
    field == 'A',
    imageId = 'id of pic1.png',
    imageId = 'id of pic2.png'
    );

    Case 1:
    field = A
    imageId = 'id of pic1.png'

    the images are both in the upload folder.

    Case 2:
    field != A
    imageId changes from 'id of pic1.png' to 'id of pic2.png'

    the 'pic1.png' image is deleted from the upload folder.

    My Espo version is 7.1.3, Advanced Pack is 2.9.3.

    I hope I well explained myself and that you can help me solving this problem.

    Thank you
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    This post should not be in the bug reports section. Please don't post such posts in bug reports.
    Last edited by yuri; 08-01-2022, 12:16 PM.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      You need to duplicate an attachment record, set sourceId = id of the original attachment record. Set the field and the relatedType corresponding to the parent record.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...