Suitecrm: Updating any field of a contact in a workflow causes loss of 3rd + associated email addresses

Created on 24 Jan 2017  路  10Comments  路  Source: salesagility/SuiteCRM

Issue

When a workflow as part of its action modifies any field of a contact, if the contact being modified has more than two email addresses associated with it then all but the first two email addresses associations are deleted!

Expected Behavior

Email associations should not be affected by modifying some other contact field.

Actual Behavior

Modifying any field of a contact in the action of a workflow caused the contact's 3rd + email associations to be deleted.

Possible Fix

I came across this issue before writing a logic hook. The only way to solve the issue was to set $GLOBALS['resavingRelatedBeans']=true; before calling $contactRec->save(); and then unsetting the global val back again (not a great solution!).

Steps to Reproduce

Please see screen shots for detailed examples

  1. Create a workflow that modifies a field of a contact
  2. Create a contact with 3 or more email associations
  3. Make the contact satisfy the conditions of the workflow
  4. Refresh the browser view of the contact and once the workflow has run you will see only two email associations!

Context

This issue causes silent and unintended data loss when using workflows and as such should be a high priority bug!

Your Environment

  • SuiteCRM Version used: 7.7.9
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): n/a
  • Environment name and version (e.g. MySQL, PHP 7): MySQL 5.6, PHP 5.4.36
  • Operating System and version (e.g Ubuntu 16.04): Ubuntu 14.04.1 LTS
Moderate Bug

All 10 comments

Test Contact prior to being updated by workflow:
contact_prior_update

Test Workflow that modifies a Contact's Phone1 field:
sample_workflow

Then I edit the Contact's phone1 field to the value of '1'. This causes tet workflow to run. Afterwards I refresh the contact and see this:
contact_post_update

@glidester , an issue has been tested, and not appear on fields existed in CRM,
question: Is this: "Phone 1" is a custom field? (please provide all properties to recreate them)

I can't remember exactly what default fields come with suite and which we have added. Looking at it I think it was the home phone field with just its label changed to 'Phone 1'.

However it is not pertinent as the bug exhibits itself whichever field of the contact you update.

phone1

@glidester , the problem is that raised issue has been changed in 3 different core fields, and not appear, so if I do not recreate your environment exactly, it will be not possible to replicate it. So the next step is to ask you to install fresh newest version of SuiteCRM and check if issue still appear.

Sorry, are you saying the issue does not occur on a fresh installation when a workflow updates a contact with more than 2 email address associations??

@glidester ,yes an issue not appear in recent version of SuiteCRM, so when you install fresh copy, and get same result, it tells us it may be something in your customisation or environment issue.

@glidester You should try your workflow on the online demo, it's a fresh install, without customizing the forms, and see if the bug occurs, and it removes all but the first 2 email addresses. https://suitecrm.com/demo

The demo hosted by SalesAgility doesn't allow admin access, so you can't use Studio there. I don't know if admin access is needed to modify workflows.

The Softaculous demo _does_ allow for admin access: https://www.softaculous.com/demos/SuiteCRM

You can indeed create a new Workflow record in the the official demo https://suitecrm.com/demo currently at 7.8.0, for the purposes of reproducing this bug report.

I tried to reproduce this bug report, and discovered what appears to be a new bug: After saving the new Workflow record, in Workflow detail view, it fails to display all of the data for the Action.

I will try to recreate from a fresh install of 7.7.9 (hopefully at some point this week).

We do have three custom modules that have a many (custom) to one (contact) relationship setup. This will be my first avenue of investigation as to the likely cause.

Was this page helpful?
0 / 5 - 0 ratings