Community
Showing results for 
Search instead for 
Do you mean 
Reply

Company Lookup using CustomSubEntity field criteria

Copper Contributor
Posts: 8
Country: USA

Company Lookup using CustomSubEntity field criteria

[ Edited ]

I've created a CustomSubEntity (Events) with Company as the ParentEntity.

 

Is there someway to show CSE fields when keying Company Criteria (Advanced Query lookup)?  

 

Even if you can't do this through the Criteria form is there a way to create the criteria XML and lookup that way?

 

I've tried saving a .CRY then modifying with my CSE information

<?xml version="1.0" encoding="utf-8"?>
<lookups>
  <lookup>
    <criteria>
      <criteriaItem>
        <columnId>9d47b5c2-16ff-44ca-86ba-38dbce541db1</columnId>
        <tableName>CUST_EVENT</tableName>
        <columnName>CUST_EventName_023201396</columnName>
        <tableDisplayName>Event</tableDisplayName>
        <columnDisplayName>EventName</columnDisplayName>
        <domain>String</domain>
        <operator>StartsWith</operator>
        <leftParentheses>0</leftParentheses>
        <rightParentheses>0</rightParentheses>
        <values>
          <value type="string">
            <dataItem><![CDATA[Test]]></dataItem>
          </value>
        </values>
        <logicalOperator>End</logicalOperator>
      </criteriaItem>
    </criteria>
  </lookup>
</lookups>

 

When I try to load the query I get

 

 

Opportunity lookups and Products (which I assume is different than a CSE since it's native) appear to work the way I'm looking for...

 

 

 

Are lookups beyond the scope of CSE's?  Or can this be done some other way, like using UILookupManager?

Copper Contributor
Posts: 8
Country: USA

Re: Company Lookup using CustomSubEntity field criteria

[ Edited ]

I worked out a custom solution to do lookups using CustomSubEntities:

 

I'm using an OleDB (and Linq2SQL) query to pull the relevant COMPANYID values then I set the CurrentCompanyList.

 

// Get the COMPANY IDs
var companyGuids = db.ExecuteQuery<Guid>("SELECT COMPANYID FROM CUST_EVENT INNER JOIN CUST_COMPANY_EVENT ON ... WHERE ...");
// Get a CompanyList using the GUIDs
Act.Framework.Companies.CompanyList companyList = ActApp.ActFramework.Companies.GetCompaniesByID(null, companyGuids.ToArray());
// Set the CurrentCompanyList using the GUIDs
ActApp.ApplicationState.CurrentCompanyList = companyList;
// Open the Company List view
ActApp.ExecuteCommand("act-ui://com.act/application/menu/view/companylist");

 

Copper Contributor
Posts: 123
Country: Canada

Re: Company Lookup using CustomSubEntity field criteria

Hey this is great and exactly what I was looking for but were you able to integrate your CustomSubEntity into the Lookup Dialog Box?