Help

Re: Link Tables Limit record selection to a view by existing relationship?

Solved
Jump to Solution
3452 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Cathy_Anderson
6 - Interface Innovator
6 - Interface Innovator

2 Tables - Constituents and Constituent Types.

Constituents holds contact information.
First Name, Last Name, Email, Phone, etc.

Constituent Type holds the taxonomy (so it has a hierarchy) to organize the Constituent data

a. Individual
a. Organizations
b. Foundation
b. Business
c. Healthcare
c. Retail
c. Personal Activities-Interests
b. Government
c. Local
c. Regional
c. Federal
b. Nonprofit
b. Religious-Educational
b. Club-Membership-Association

I have three fields in Constituent to link to the Constituent Type

Constituent Type
Links to Constituent Types with a Limit record selection to a view only a.
Works great because there are only 2 options.

Constituent Organization Type
Links to Constituent Types with a Limit record selection to a view only b.
Works great because currently, only Organizations have multi-levels.

Constituent Organization Area.
This is where I want to link to “Constituent Types” based on the “Constituent Organization Type” selected in the “Constituents” table.
Creating a view for only c, doesn’t work because it will not limit the user to only the terms related to the “Organization Type” selected in the “Constituents” table.

Any ideas???

11 Replies 11

Correct. Each field requires a specific type of data. Because you need a link, you’ll need to get the ID of the record that you’re linking to. If that’s the record that you chose for category, then you’re in luck, because the ID is also one of the available attributes.

Also, as the error message indicated, you need to pass an array of objects to create links. Here’s how to restructure that line to do this:

await name.updateRecordAsync(parent, {'test': [{id: category.id}]});

And with that, I express my gratitude. Thanks so much! Hopefully soon javascripting will sink in for me.

let name = base.getTable('Constituents');
let parent = await input.recordAsync('The constituent', name);
if (parent) {
    output.text(parent.getCellValueAsString('Organization Type'));
}

let taxonomy = base.getTable('Taxonomy');
let orgtype = parent.getCellValueAsString('Organization Type');

let view;
if (orgtype === 'Business') {
    view = taxonomy.getView('Affiliations--Business');
} else {
    view = taxonomy.getView('Affiliations');
}
// pick a category
let category = await input.recordAsync('Pick affiliation', view);

// if there is a category
if (category) {
await name.updateRecordAsync(parent, {'Affiliation': [{id: category.id}]});
}