Aug 07, 2020 01:25 PM
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???
Solved! Go to Solution.
Aug 12, 2020 02:08 PM
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}]});
Aug 12, 2020 02:51 PM
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}]});
}