Announcement

Collapse
No announcement yet.

Formula to to change field value if no attachment (Should be easy?)

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

  • Formula to to change field value if no attachment (Should be easy?)

    Hi Espo Community,

    I have been trying to figure out how to make a simple IfThen formula work.

    I have a field with multiple attachments and another status field.

    The formula should simply change the status field to "attachment available" if there is any attachment in the attachment field.

    ifThen(attachmentid !=null, status="attachment available")

    I tried attachementname as well as id.


    null works well in case of other fields, but apparently no attachment in an attachment field does not translate to null​ in the backend.

    Does anyone know what an empty attachment translate to in the backend so I can make this formula work?





  • #2
    Hi DavidatEspo,

    Please try to use the following formula script:
    Code:
    if (attachmentsIds != null) {
        status = 'attachment available'
    }
    Look carefully at the name of your Attachment Multiple field in the Administration > Your Entity Name > Fields. It can be called an attachment, attachments, or whatever you like, but the main condition is to use exactly this name + the Ids part.

    Click image for larger version

Name:	image.png
Views:	142
Size:	5.7 KB
ID:	102416​​

    Comment


    • #3
      lazovic, Thank you. I can see my typo. Unfortunate it still didn't work. However I found a way to make it work: ifThen(array\length(attachmentIds) > 0, status = "attachment available")

      Comment

      Working...
      X