OfficeClip Forums
»
General Discussion
»
Developer Resources
»
Custom Coding
»
How to add Tags to the Contacts directly from the database
Rank: Administration Groups: Registered, Developer, Administrators Posts: 27
|
The following tables are used to add Tags to the Contact: tag - tag_id is the primary key, tag_group_id is the foreign key of the taggroup table taggroup - tag_id is the foreign key of the tag table, org_id is the organization id in the groups table. For ungrouped tags the name is always hardcoded to !! tabobject - tag_id is the foreign key of the tag table, object_type_id = 14 (for contacts) and object_id is the same as the contact_id in the contactmeta table. Here are the steps: - Find the contact_id of the contact from the contactmeta table
- Get the org_id from the groups table
- Add an entry to the taggroups table
- Add an entry to the tag table
- Get the contact_id from the contactmeta table
- Add entries to the tagobject table
Lets see an example: - Adding a tag group: insert into taggroup (org_id, name) values (1, 'My Group') -- note tag_group_id is the primary key
- Adding a tag: insert into tag (tag_group_id, name) values (1, 'My Tag') -- note that tag_id is the primary key, also you cannot have the same tag name for two entries.
- Adding the required tags: insert into tagobject select 1, 14, 23
Note that you can combine multiple sql statements into one using multiple insert and selects statements
WARNING: Please take a backup copy of the database before making any direct changes, any errors during these steps may take the database to an inconsistent state which may not be recoverable.
|
|
|
|
OfficeClip Forums
»
General Discussion
»
Developer Resources
»
Custom Coding
»
How to add Tags to the Contacts directly from the database
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The OfficeClip Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close