Cannot assign an action to a workflow state. Getting Database error.

Events happening in the community are now at Drupal community events on www.drupal.org.
beckyjohnson's picture

I set up work flow with 5 different workflow states and wanted to assign an action to one state in particular. I wanted the system to send out an email when the content type reached a certain stage.

I click on Action and go to the trigger page. On the stage I want, I use the drop down menu to pick send an email and then hit save. However, the action does not save and instead I get the following error.

user warning: Duplicate entry 'workflow-workflow-certified_product_datab-1' for key 1 query: INSERT INTO trigger_assignments values ('workflow', 'workflow-certified_product_database-1', '1', 1) in /var/www/vhosts/mysite.org/subdomains/registry/httpdocs/modules/trigger/trigger.admin.inc on line 206.

I looked in my database and found the following data in my trigger assignments table (screenshot).

http://registry.wimaxforum.org/trigger_screenshot.jpg

I tried deleting each of the rows in turn that say workflow-certified-product-deb.... and re assigning the action but nothing happened. I eventually just got the same error again. I have no idea what is causing this problem. I have installed workflow before with no problems...this is really weird.

I hope someone can help me figure this out.

Becky

Comments

Your 'op' is too long

james marks's picture

The 'op' field in the assignment_triggers table holds 32 characters and is a primary key meaning it has to be unique.

Your op value, 'workflow-certified_product_database-1', exceeds that length and is being truncated to 32 characters: 'workflow-certified_product_datab'. Any additional entries would be truncated to the same value which, because the field value must be unique, isn't allowed:

workflow-certified_product_database-1 -> 'workflow-certified_product_datab
workflow-certified_product_database-2 -> 'workflow-certified_product_datab (not unique)
workflow-certified_product_database-3 -> 'workflow-certified_product_datab (not unique)
workflow-certified_product_database-4 -> 'workflow-certified_product_datab (not unique)

Try shortening "certified_product_database" to "cert_prod_db" and you should be fine.

ok. So, should I just edit

beckyjohnson's picture

ok. So, should I just edit the name in my database or should I re-set up everything in workflow?

Thanks for the help!

Becky

So I renamed my work flow to

beckyjohnson's picture

So I renamed my work flow to cert_prod_db and still got the same error.....uh...Did you mean that I need to change the machine name of my content type?

Thanks,
Becky

Yup! changing the content

beckyjohnson's picture

Yup! changing the content type machine name worked! Thanks!
Becky

Long 'op' / content type machine name

james marks's picture

Yes, I believe you're correct; you need to change the the machine name of your content type. Sorry, I should have been more clear. :)

And you already figured it out, I see. :)

could another way be....

Nashville Drupaler's picture

could you also increase the varchar limit in the offending field? - or does this create other problems? (just curious - that's the way I did it...)

The meek shall inherit the Earth, The Bold shall inherit the Stars

varchar

RichardLynch's picture

While MySQL lets you go "over" it's a Bad Idea (tm) to put more than 255 in varchar() length.

So, sure, go up to varchar(255) if you like.

Only problem would be the size of the index and data itself, but unless you have zillions of actions, I don't see that as a problem...

Not sure why they used 32 in the first place...

Thanks

Nashville Drupaler's picture

I just kicked it to 64 - maybe I'll reach out to the developer and see if he can bump it up

The meek shall inherit the Earth, The Bold shall inherit the Stars

Workflow

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: