6

Articles don't support lookup fields and maintaining a "foreign key" to lookup an article could get messy. What's options are available and what are the pros and cons?

2 Answers 2

3
+50

I've implemented a custom object with a text field to store the Id of a related OpportunityLineItem which you can't specify as the target for a lookup. The implementation wasn't terribly difficult and we haven't run into any issues.

Pros

  • You can link to objects that don't support lookups

Cons

  • You can't traverse the relationship in a soql query (i.e. obj.article__r.name)
  • If you filter on the text lookup you must use the same number of characters as the text lookup*
  • You have to manually delete the object or null out it's lookup if the parent object is deleted

* This use to be an issue with older API version which we're inconsistent about using 15 or 18 digit ids. For current API versions just use 18 characters for the text lookup and you'll be fine.

In your scenario the main thing to consider is deleting the object once the parent article is deleted. Usually you can do this simply with a trigger on the parent object, but that's not available for articles. A daily batch clean up script can take care of this.

1

An Article can potentially be related to several Custom Object records, like one article could be related to many cases.

For Cases, this relationship is modelled via the CaseArticle 'Junction' Object, I would imagine a similar solution to resolve the relationship with a Custom Object.

1
  • 1
    Cases are special though. Would you have to rebuild this entire mechanism (with all associated maintenance) yourself?
    – Wes Nolte
    Commented Jul 15, 2013 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .