2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2022-07-10 01:37:41 -07:00
export const searchOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
noDataExpression : true ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
options : [
{
name : 'Query' ,
value : 'query' ,
description : 'Search for records by entering search queries of your choice' ,
2022-07-13 01:38:12 -07:00
action : 'Query a search' ,
2022-07-10 01:37:41 -07:00
} ,
{
name : 'Lookup' ,
value : 'lookup' ,
description : 'Search for the name or email address of records' ,
2022-07-13 01:38:12 -07:00
action : 'Lookup a search' ,
2022-07-10 01:37:41 -07:00
} ,
] ,
default : 'query' ,
} ,
] ;
export const searchFields : INodeProperties [ ] = [
// ----------------------------------------
// Search: query
// ----------------------------------------
{
displayName : 'Search Term' ,
name : 'query' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'query' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
description : 'Enter a term that will be used for searching entities' ,
} ,
{
displayName : 'Search on Entities' ,
name : 'entities' ,
type : 'multiOptions' ,
options : [
{
name : 'Contact' ,
value : 'contact' ,
} ,
{
name : 'Deal' ,
value : 'deal' ,
} ,
{
name : 'Sales Account' ,
value : 'sales_account' ,
} ,
{
name : 'User' ,
value : 'user' ,
} ,
] ,
required : true ,
default : [ ] ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'query' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
description : 'Enter a term that will be used for searching entities' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'query' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
description : 'Whether to return all results or only up to a given limit' ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
2022-07-10 02:20:57 -07:00
typeOptions : {
minValue : 1 ,
} ,
2022-07-10 01:37:41 -07:00
default : 25 ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'query' ] ,
returnAll : [ false ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
description : 'Max number of results to return' ,
} ,
// ----------------------------------------
// Search: lookup
// ----------------------------------------
{
displayName : 'Search Field' ,
name : 'searchField' ,
type : 'options' ,
options : [
{
name : 'Email' ,
value : 'email' ,
} ,
{
name : 'Name' ,
value : 'name' ,
} ,
{
name : 'Custom Field' ,
value : 'customField' ,
2022-08-01 13:47:55 -07:00
description :
'Only allowed custom fields of type "Text field", "Number", "Dropdown" or "Radio button"' ,
2022-07-10 01:37:41 -07:00
} ,
] ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'lookup' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
description : 'Field against which the entities have to be searched' ,
} ,
{
displayName : 'Custom Field Name' ,
name : 'customFieldName' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'lookup' ] ,
searchField : [ 'customField' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
} ,
{
displayName : 'Custom Field Value' ,
name : 'customFieldValue' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'lookup' ] ,
searchField : [ 'customField' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
} ,
{
displayName : 'Field Value' ,
name : 'fieldValue' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'lookup' ] ,
searchField : [ 'email' , 'name' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
2024-07-29 05:27:23 -07:00
placeholder : 'Add option' ,
2022-07-10 01:37:41 -07:00
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'search' ] ,
operation : [ 'lookup' ] ,
2022-07-10 01:37:41 -07:00
} ,
} ,
options : [
{
displayName : 'Entities' ,
name : 'entities' ,
type : 'multiOptions' ,
default : [ ] ,
options : [
{
name : 'Contact' ,
value : 'contact' ,
} ,
{
name : 'Deal' ,
value : 'deal' ,
} ,
{
name : 'Sales Account' ,
value : 'sales_account' ,
} ,
] ,
2023-08-01 06:32:33 -07:00
2022-12-29 03:20:43 -08:00
description :
"Use 'entities' to query against related entities. You can include multiple entities at once, provided the field is available in both entities or else you'd receive an error response." ,
2022-07-10 01:37:41 -07:00
} ,
] ,
} ,
] ;