xTuple.com xTupleU Blog & News Customer Support

Documents and Relationships

Hi Everyone

I have an unique situation where our Customers have relationships, which must be documented. For example and Insurance Company has policy holders which are Employers. Employers have Employees which are Patients.And so on.

I have added these relationships , so if you view the Document tab of a Customer, you will see the “Attached” relationships.

My initial problem was do set the description field to display the Customer Type of the related customer. I got to hand it to you guys for the source table. An ingenious way to extend the docass table through the function public._docinfo.

So I modified the source row # 8 for the CMRA source name to set the source_desc_field to “firstline(custtype_code)”
and the source_joins to “join custinfo on crmacct_cust_id = cust_id join public.custtype on cust_custtype_id = custtype_id”

This displays the Customer type when I look up and Employer and use the document tab to find the Insurance Company.

But, the reverse does not happen. When I lookup the Insurance Company, all the Employers are listed, but the Customer Type is empty.

In my docass table, I always set the docass_source_id to the insurance company id and the docass_target_id is set to the employer. I do not have the reverse relationships defined. Because you list the relationship both ways anyway.

So I am trying to figure if

  1. I can extend my source join
  2. change the public._gettargetdocument function
  3. change public._docinfo function ( my vote is here)
  4. create the reverse docass relationship. (ugly)
  5. Or am I missing something ( most likely)

What do you guys think?

Bob