attribute in formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hupka36@gmail.com
    Junior Member
    • Jan 2021
    • 16

    attribute in formula

    Hi, How can I access in formula to same attributes in different records:
    for example:
    I Have meeteing with fields
    datestart=1.1.2020
    repeat=365

    after marking in active record
    status = close
    I need create duplicate of actual record

    and set datestart(field in new) = datestart (field in old) + repeat (field in old)

    can i do it for example thru the Id of record?
    something like

    ifThen(status = 'Meeting',
    $activeid = Meetingid;
    $newid = record\create('Meeting');
    record\update('Meeting', $newid , $newid.datestart, datetime\addDays($activeid.datestart, $activeid.repeat)
    )
    etc...

    thank you

    wbr .s.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    This one works good:
    Code:
    ifThen(
        entity\isAttributeChanged('status') && status == 'Held',
        record\create(
            'Meeting',
            'name', string\concatenate(name, " - duplicated"),
            'dateStart', datetime\addDays(dateStart, repeat)
        )
    );
    BTW, if you have Advanced Pack you can easily achieve the same result with Workflow https://www.espocrm.com/extensions/advanced-pack/.

    Comment

    • hupka36@gmail.com
      Junior Member
      • Jan 2021
      • 16

      #3
      Hi,
      you are right, but advanced pack resp. workflow can't concentrate field + text (in name) and field + field (in datestart)
      it must be used as included formula.


      Thank You

      PS: with advanced pack is more fun

      Comment

      Working...