Establishing Context in a ListPage class when using Account Entity

1 minute read time.

The Account entity is enabled in Sage CRM systems that are integrated with Sage ERP products using the Sage SOAP Web Services contract.

  • Sage 200 (UK) - NB.  This is only true for the old-style Classic integration now replaced with the Qumulus Qnect integration.
  • Sage 100 (France)
  • Sage 100 (Germany)

Note: Although the account entity maybe implemented in the data model in these systems it may not be enabled within the main interface!

But in a standard Sage CRM System the Account entity is not used and is not visible, so the scope of this article is very precise.

If you are working with the ListPage specialised class and are trying to establish context then the constructor will look like this

public GeneralListPage()
: base("opportunity", "opportunitylist", "opportunityfilterbox")
{
FilterByField = "oppo_primarycompanyid";
FilterByContextId = (int)Sage.KeyList.CompanyId;
}

BUT the account entity does not appear in the KeyList enumerator. This uses the idea of key values to determine the context needed. You can learn more about key values in the article "Long List of Key Values for Sage CRM 6.2".

This shows that the key for the Account entity would be 24. The URL would contain the element " &key24="

So when working with the Account entity the code for the ListPage can either be hard coded

public GeneralListPage()
: base("opportunity", "opportunitylist", "opportunityfilterbox")
{
FilterByField = "oppo_primaryaccountid";
FilterByContextId = 24; // 24 is the account key number
}

Or the concept of the dominant key should be used. This returns the key that is in main context.

public GeneralListPage()
: base("opportunity", "opportunitylist", "opportunityfilterbox")
{
FilterByField = "oppo_primaryaccountid";
FilterByContextId = Keys[(int)Sage.KeyList.DominantKey]; // this should return 24 when you are in account context.
}