Creating a static group and Key Attributes table

We have a requirement to create a static group in Sage CRM based on an external email list.  I have worked out how I will get the person and company ids that I need to create the group.  I am having an issue determining what all needs to be populated for a static group.

Bases on my research, dynamic group data is stored in four metadata tables for reports.  For a static group, group data is stored in the four report tables along with data in the Key Attributes tables.  The Key Attributes tables are where I need some assistance.

However, I am having trouble finding an article explaining what needs to be populated in the Key Attributes table for a static group.  Since the Key Attributes tables are also used to track Key Attributes data for Primary Entities, most of the articles that I have found on the Key Attributes table relate to that scenario.

I have found a couple of articles that show how to create a group using CRM.TargetLists.  However, they appear to be for dynamic lists and appear to only populate the custom_report metadata tables as follows...

  • custom_reports
  • custom_reportsearches
  • custom_reportbands
  • custom_reportfields

I cannot find any articles that specify which tables to populate in the Key Attributes tables for a static group.  If someone could point me to a good article, I would greatly appreciate it.

Without an article to follow, this is what I have been able to determine.  These are the tables that need to be populated for a static group.

  DDCategory, DData, DDField

DDCategory appears to be the header record and contains the Group Name.  The id from the header record created here is then populated in the custom_reports table.  This groups your static list to the group.  There is a "ParentID" field on this record that I do not see what it is related to.  The value appears to be 2.  Can someone tell me what this ParentID is linked to?

DData appears to be the details that make up the list.  Therefore it contains the entity and the entityrecord for each record that makes up the list.

DDField.  This is the table that I don't understand.  I can see that there are two records for each DDCategory.

  For the first row, the field ddfld_basetype = ShortStr.  For the second row, the field ddfld_basetype =  HIDDEN

  Can somone explain the purpose of these two rows?

  There is also a field in this table that contains a "ParentID".  DDFld_ParentID.  Can someone tell me what this ParentID relates to?  They all appear to be populated with 4.  However, I don't know what that represents.

I am able to create the information in the metadata tables using CRM.TargetLists and the assistance of a couple of articles.  I believe I can work out the scripts to create the records in the Key Attributes table if I can understand my questions to some of the pieces above.

Any assistance would be greatly appreciated. These are the articles that I used...

https://www.sagecity.com/sage-global-solutions/sage-crm/b/sage-crm-hints-tips-and-tricks/posts/creating-a-dynamic-group-in-sage-crm-using-the-com-object-targetlists

https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2008/03/18/reports-saved-searches-and-groups.aspx

https://help.sagecrm.com/on_premise/en/2020R2/Dev/Content/Developer/ASP%20Object%20Reference/CRMTargetLists%20Object/AS_CRMTargetListsObject.htm

  • 0

    Groups should really be created/managed entirely by the CRMTargetLists object if at all possible, with no need to manually touch the underlying tables which are pretty much undocumented in the context of groups.

    You will need to set TargetBlock.IsFixedGroup = true to make it static, sett TargetList.WhereClause appropriately then TargetList.Retreive() to populate the group, then save using TargetList.Save();

    See example on creating a person static group.
     https://help.sagecrm.com/on_premise/en/2022R1/Dev/Content/Developer/ASP%20Object%20Reference/CRMTargetLists%20Object/AS_CRMTLEGCreatingAndSavingATL.htm

    Some lines near the top seem to be mushed together in that example though.

    ParentID fields will generally reference another record in the same table e.g.
    DDCategory - DDCat_ParentID: This links to another DDCategory record. This is likely to be 2 which has the name "Group Entries".

    If you really need to manage the SQL tables manually, your best option is to manually create a group from the UI then investigate the tables and attempt to copy the format of the records that have been added.

    DDFields appear to be something to do with the Excluded checkbox. Just copy the format if you really need to as they are practically identical for each static group just with a different categoryid.