-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into salesforce-custom-obj…
…ect-external-id
- Loading branch information
Showing
532 changed files
with
28,432 additions
and
5,167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,7 +267,7 @@ interface InputField { | |
dynamic?: boolean | ||
|
||
/** Whether or not the field is required */ | ||
required?: boolean | ||
required?: boolean | DependsOnConditions | ||
|
||
/** | ||
* Optional definition for the properties of `type: 'object'` fields | ||
|
@@ -358,6 +358,126 @@ const destination = { | |
|
||
In addition to default values for input fields, you can also specify the defaultSubscription for a given action – this is the FQL query that will be automatically populated when a customer configures a new subscription triggering a given action. | ||
|
||
## Required Fields | ||
|
||
You may configure a field to either be always required, not required, or conditionally required. Validation for required fields is performed both when a user is configuring a mapping in the UI and when an event payload is delivered through a `perform` block. | ||
|
||
**An example of each possible value for `required`** | ||
|
||
```js | ||
const destination = { | ||
actions: { | ||
readmeAction: { | ||
fields: { | ||
operation: { | ||
label: 'An operation for the readme action', | ||
required: true // This field is always required and any payloads omitting it will fail | ||
}, | ||
creationName: { | ||
label: "The name of the resource to create, required when operation = 'create'", | ||
required: { | ||
// This field is required only when the 'operation' field has the value 'create' | ||
match: 'all', | ||
conditions: [ | ||
{ | ||
fieldKey: 'operation', | ||
operator: 'is', | ||
value: 'create' | ||
} | ||
] | ||
} | ||
}, | ||
email: { | ||
label: 'The customer email', | ||
required: false // This field is not required. This is the same as not including the 'required' property at all | ||
}, | ||
userIdentifiers: { | ||
phone: { | ||
label: 'The customer phone number', | ||
required: { | ||
// If email is not provided then a phone number is required | ||
conditions: [{ fieldKey: 'email', operator: 'is', value: undefined }] | ||
} | ||
}, | ||
countryCode: { | ||
label: 'The country code for the customer phone number', | ||
required: { | ||
// If a userIdentifiers.phone is provided then the country code is also required | ||
conditions: [ | ||
{ | ||
fieldKey: 'userIdentifiers.phone', // Dot notation may be used to address object fields. | ||
operator: 'is_not', | ||
value: undefined | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
**Examples of valid and invalid payloads for the fields above** | ||
|
||
```json | ||
// This payload is valid since the only required field, 'operation', is defined. | ||
{ | ||
"operation": "update", | ||
"email": "[email protected]" | ||
} | ||
``` | ||
|
||
```json | ||
// This payload is invalid since 'creationName' is required because 'operation' is 'create' | ||
{ | ||
"operation": "create", | ||
"email": "[email protected]" | ||
} | ||
// This error will be thrown: | ||
"message": "The root value is missing the required field 'creationName'. The root value must match \"then\" schema." | ||
``` | ||
|
||
```json | ||
// This payload is valid since the two required fields, 'operation' and 'creationName' are defined. | ||
{ | ||
"operation": "create", | ||
"creationName": "readme", | ||
"email": "[email protected]" | ||
} | ||
``` | ||
|
||
```json | ||
// This payload is invalid since 'phone' is required when 'email' is missing. | ||
{ | ||
"operation": "update", | ||
} | ||
// This error will be thrown: | ||
"message": "The root value is missing the required field 'phone'. The root value must match \"then\" schema." | ||
``` | ||
|
||
```json | ||
// This payload is invalid since 'countryCode' is required when 'phone' is defined | ||
{ | ||
"operation": "update", | ||
"userIdentifiers": { "phone": "619-555-5555" } | ||
} | ||
// This error will be thrown: | ||
"message": "The root value is missing the required field 'countryCode'. The root value must match \"then\" schema." | ||
``` | ||
|
||
```json | ||
// This payload is valid since all conditionally required fields are included | ||
{ | ||
"operation": "update", | ||
"userIdentifiers": { | ||
"phone": "619-555-5555", | ||
"countryCode": "+1" | ||
} | ||
} | ||
``` | ||
|
||
## Dynamic Fields | ||
|
||
You can setup a field which dynamically fetches inputs from your destination. These dynamic fields can be used to populate a dropdown menu of options for your users to select. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.