No announcement yet.

Calculation of workflow when importing data

  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculation of workflow when importing data

    This bug is about import and workflow

    There are 2 entities, entity_parent and entity_child, there is a many to one relationship between entity_child and entity_parent
    In entity_parent, there is a float field, total_value, which is the sum of float field ind_value of all its child, entity_child.
    and there is workflow for entity_child, when a entity_child is created, update the total_value of its parent, entity_parent by below formula

    entity_parent.total_value = entity_parent.total_value + entity_child.ind_value

    It works perfectly when i add the entity_child using web UI, the total_value of entity_parent shows the correctly value.

    However, when i import entity_child using import page with csv file, the total_value of entity_parent shows the wrong value


    ​​​ind_value of entity_child 1 = 1.5
    ​​​ind_value of entity_child 1 = 2.5

    after import total_value of entity_parent = 3
    if i add above 2 records using web UI, total_value of entity_parent = 4

    It seems that non-integer numbers are ignored when doing workflow calculation for import

  • #2
    Can't reproduce. What type of field do you use? What decimal delimiter used is in system and which one is in file?


    • #3
      the data type in crm is float
      the Field Delimiter in system and file are ","



      • #4
        I have do the following things in (version: 5.1.1) using admin account

        1.Create a Mstr entity
        2. Add a float field 'total' in Mstr Entity with 0 default value
        3. Create a Detail entity
        4. Add a float field 'val' in Detail Entity
        5. Create a workflow

        Target Entity: Detail
        Trigger Type: After record created
        Update Related Record >> Mstr
        total = total + targetEntity\attribute('val');

        7. Create a new record (name: A) in Mstr
        8. Import csv to Detail, set default Mstr = A, below is the content
        name val
        A1 1.2
        A2 1.3
        A3 0.4
        In the preview, i see
        name val
        A1 1.2
        A2 1.3
        I assumed espoCRM read the csv correctly
        9. After import, 3 detail records are imported with correct value, but the value of field 'total' of Mstr recrod A is 2, not 2.9
        Attached Files
        Last edited by Vincent; 03-29-2018, 01:59 AM.


        • #5
          reproduced. Will be fixed in the next EspoCRM version. Thanks