Announcement

Collapse
No announcement yet.

Refresh/Recalculate Formula after linking Relationship

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

  • Refresh/Recalculate Formula after linking Relationship

    Now that I'm using formula more I noticed this issue, or maybe my formula is bad.

    But when you link a Relationship through bottom panels, the formula doesn't get run again. Anyone know can I can re-run it again after I create a new relationship?

    I was thinking of using the "Modified Date" to do that but linking/creating relationship doesn't change this date.

    Thank you.

    Screenshot for a better picture:
    Click image for larger version

Name:	image.png
Views:	215
Size:	23.5 KB
ID:	91659
    So this entity I have formula to sum all Credit and sum all Debit. When I link it or create a new Record using the + button, the formula don't run.

    I need to make some edit in the Case entity itself.

  • #2
    Hi espcrm,

    Please tell me if I understand correctly that you need to add to the total amount of Debit and Credit in the Case the values of the Debit and Credit of Accounting when you link it to this Case?

    Comment


    • #3
      Originally posted by lazovic View Post
      Hi espcrm,

      Please tell me if I understand correctly that you need to add to the total amount of Debit and Credit in the Case the values of the Debit and Credit of Accounting when you link it to this Case?
      Hi lazovic, I can already calculate it using these formula. But formula doesn't run when I just link it.

      It only run when I made edit to the Case entity. So the question is, how to make Formula "re-run" after I link.

      Comment


      • #4
        Hello espcrm

        Formula is a custom EspoCRM language, which allows GUI Users to write beforeSave hooks, without actually coding in PHP.

        A beforeSave hook, is a backend function that is executed after the system receives a "Save" command but before the data is actually persisted into the database.

        The actual result is that a formula will not execute until you save the entity that contains the formula.

        If your formula is attached to the "Case" entity, then it will run when the case entity is saved.

        If your formula is attached to the "Accounting" entity, it will run when the Accounting record is saved.

        There is no GUI method at present to run formulas at will.

        To do that you will need to do some coding https://forum.espocrm.com/forum/gene...4301#post64301

        or you can purchase an extension which will create a formula re-calculate button for you https://payhip.com/b/28Dhw

        Comment


        • espcrm
          espcrm commented
          Editing a comment
          Hi telecastg! Thank you. That too bad, look like it can't be done (easily).

          I couldn't get this out of my head and I think and think. *Light bulb* moment and I thought. "Not why create a Formula in "Accounting" that does an update to the "Case" entity"?

          Wouldn't that forced the Case's Formula to run?! This is a excited theory that I hope to work.... I will eventually get around to trying it.

          Right now I'm playing with even more formula to automatic link my Email > Case correctly. It looking good so far as a very simple formula is expand to hard to read mode for me.

          Hopefully once I'm happy with it covering and 'no more bug' I will post it at the usual place.

          Thank you again. By the way, I think Yuri recently added some "beforeSAVE" code in Git, but then he say, "This is for developer only" so it out of my hand till easy version come along.
      Working...
      X