I’m trying to create a trigger that can be search, in this case it’s for employees.
I created a simple trigger (find_employee_by_name):
const perform = async (z, bundle) => {
return u
{ id: '507d7a07-9c5f-4d36-8280-aa4651c65977', name: 'Jane Doe' },
{ id: 'c960fa85-ce80-448b-bd8f-392df5715f45', name: 'Mike Canine' }
];
};
module.exports = {
operation: {
perform: perform,
outputFields: d
{ key: 'id', type: 'string' },
{ key: 'name', type: 'string' },
],
},
display: {
description: 'Find an employee by his or her name.',
hidden: true,
label: 'Find Employees',
},
key: 'find_employee_by_name',
noun: 'Employee',
};
then referenced it in a create:
const perform = async (z, bundle) => {
// omitted for brevity
};
module.exports = {
display: {
description: "lorem ipsum.",
hidden: false,
label: 'lorem ipsum',
},
key: 'update_employee',
noun: 'Employee',
operation: {
perform: perform,
inputFields: d
{
key: 'EmployeeId',
label: 'Employee Id',
required: true,
list: false,
altersDynamicFields: false,
helpText: 'Id of the employee',
},
{
key: 'ManagerId',
label: "Manager",
required: false,
type: 'string',
dynamic: 'find_employee_by_name.id.name',
search: 'find_employee_by_name.name',
list: false,
altersDynamicFields: false,
helpText: "The employee's manager."
},
],
outputFields: d
{ key: 'id' },
{ key: 'url' },
],
},
};
In the index.js file, I reference the trigger:
...
const findEmployeeByNameTrigger = require('./triggers/find_employee_by_name.js');
...
module.exports = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
...
triggers: {
...
findEmployeeByNameTrigger.key]: findEmployeeByNameTrigger,
...
},
authentication: authentication,
};
When I validate the script I get an error:
creates.update_employee_position_status field "ManagerId" connects to search "find_employee_by_name", which doesn't exist (D013)
What am I missing?