I have the following rule:
{ "rules_post_nodes_to_facebook_wall_on_update" : {
"LABEL" : "Post nodes to Facebook Wall",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "facebook" ],
"REQUIRES" : [ "rules", "fb_autopost_entity" ],
"ON" : { "node_insert" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "blog" : "blog", "news_updates" : "news_updates" } }
}
},
{ "node_is_published" : { "node" : [ "node" ] } },
{ "data_is" : { "data" : [ "node:field-facebook-published" ], "value" : "1" } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "facebook_publication",
"param_type" : "link",
"param_user" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "facebook_link" : "Facebook Link" } }
}
},
{ "data_set" : {
"data" : [ "facebook-link:field-facebook-link" ],
"value" : [ "node:url" ]
}
},
{ "data_set" : {
"data" : [ "facebook-link:field-facebook-message" ],
"value" : [ "node:field-facebook-message" ]
}
},
{ "publish_to_facebook" : {
"USING" : { "publication" : [ "facebook-link" ], "pages" : "272516998707" },
"PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
}
},
{ "data_set" : {
"data" : [ "facebook-link:facebook-id" ],
"value" : [ "facebook-publication-id" ]
}
},
{ "entity_save" : { "data" : [ "facebook-link" ] } }
]
}
}
When I create a new Blog or News node in Drupal I get the following error and the node is not created in Drupal.:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'facebook_publication-1-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_field_facebook_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_facebook_link_value, field_facebook_link_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => facebook_publication [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => link [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => https://saintfrancisocc.org/blog/fr_tommy_sheppard/2015/09/update_3_proj... [:db_insert_placeholder_7] => ) in field_sql_storage_field_storage_write() (line 514 of modules/field/modules/field_sql_storage/field_sql_storage.module).
Comments