Difference in Script task and Task in BPM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esendino
    Senior Member
    • May 2019
    • 158

    Difference in Script task and Task in BPM

    Hello.

    I'm not sure what the differences are between a Script Task and a Task in BPM.
    .
    Task has different options. You can update the Target record or create or update related records and so on.

    It's clear that in a script you can't update anything in the database. You can only calculate.

    I have been using Task and inside it the Update target record option every time I needed to do calculations even if I did not update anything in the database.

    I have been recommended to use Task Script instead.

    When I went to replace the Task with Script Task, I saw that the code contains instructions with this form.

    $someField = FieldInTheDataBase;

    Although I don't update the database, I use in the calculations often fields from the database.

    And my doubt is, inside a task script
    Can I use references to database fields like that example?
    Can be used other fields from related different entities like in entity.field?
    Can I use all the formulas that retrieve information from the database, for example record\findOne?

    Thank you very much.
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Hi,

    You can use Script Task for updating the target record, but the more proper way is to use Task > Update Target Record.

    You can't update related records in Script Task. Use Task > Update Related Record.

    You can use formula that accesses the database.
    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

    • esendino
      Senior Member
      • May 2019
      • 158

      #3
      Thanks for your fast response

      Comment

      Working...