Now tags are loaded for the user (contactTag:add) (#1267)

This commit is contained in:
Ricardo Espinoza 2020-12-23 02:23:40 -05:00 committed by GitHub
parent f36af0fcfd
commit 0f0e67eb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -298,6 +298,19 @@ export class ActiveCampaign implements INodeType {
} }
return returnData; return returnData;
}, },
// Get all the available tags to display them to user so that he can
// select them easily
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const { tags } = await activeCampaignApiRequest.call(this, 'GET', '/api/3/tags', {});
for (const tag of tags) {
returnData.push({
name: tag.tag,
value: tag.id,
});
}
return returnData;
},
}, },
}; };

View file

@ -38,7 +38,10 @@ export const contactTagFields = [
{ {
displayName: 'Tag ID', displayName: 'Tag ID',
name: 'tagId', name: 'tagId',
type: 'number', type: 'options',
typeOptions: {
loadOptionsMethod: 'getTags',
},
default: '', default: '',
required: true, required: true,
displayOptions: { displayOptions: {