-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for CustomerNeed
entity (Create, Trigger)
#88
Add support for CustomerNeed
entity (Create, Trigger)
#88
Conversation
required: false, | ||
label: "Customer ID", | ||
helpText: "The ID of the customer to create the need for", | ||
key: "customerId", | ||
}, | ||
{ | ||
required: false, | ||
label: "External Customer ID", | ||
helpText: "The external ID of the customer the need belongs to", | ||
key: "customerExternalId", | ||
}, | ||
{ | ||
required: false, | ||
label: "Issue ID", | ||
helpText: "The ID of the issue this need is for", | ||
key: "issueId", | ||
type: "text", | ||
}, | ||
{ | ||
required: false, | ||
label: "Attachment ID", | ||
helpText: "The ID of the attachment this need is associated with", | ||
key: "attachmentId", | ||
type: "text", | ||
}, | ||
{ | ||
required: false, | ||
label: "Attachment URL", | ||
helpText: "Optional URL for the attachment associated with the customer need", | ||
key: "attachmentUrl", | ||
type: "text", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
customerId
and customerExternalId
, as well as attachmentId
and attachmentUrl
are mutually exclusive. This is enforced at the GraphQL level but didn't see any good way to specify field constraints in the docs unless we want to go down the road of having dynamic fields. Not sure if it's worth the added complexity 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could throw an error before hitting our API in createCustomerNeedRequest
if both fields are set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's probably the best option. I added some checks in createCustomerNeedRequest
:
Before | After |
---|---|
![]() |
![]() |
Ideally, we would improve on the error parsing in order to relay all GraphQL validation errors. I will follow-up on that as we might want to make this error handling a bit more generic in order to benefit other Zapier creates.
Error payload
{
"errors": [
{
"message": "Argument Validation Error",
"path": [
"customerNeedCreate"
],
"locations": [
{
"line": 1,
"column": 80
}
],
"extensions": {
"code": "BAD_USER_INPUT",
"validationErrors": [
{
"target": {
"customerId": "5ae1a484-af7e-48aa-b32e-3d327ec599eb",
"issueId": "28bf8fe5-5aac-4a1d-9fd0-057a1e9d6fdd",
"attachmentId": "12",
"body": "Content of the request",
"attachmentUrl": "https://"
},
"value": "12",
"property": "attachmentId",
"children": [],
"constraints": {
"isUuid": "attachmentId must be a UUID"
}
},
{
"target": {
"customerId": "5ae1a484-af7e-48aa-b32e-3d327ec599eb",
"issueId": "28bf8fe5-5aac-4a1d-9fd0-057a1e9d6fdd",
"attachmentId": "12",
"body": "Content of the request",
"attachmentUrl": "https://"
},
"value": "https://",
"property": "attachmentUrl",
"children": [],
"constraints": {
"customValidation": "attachmentUrl is not a valid URL"
}
}
],
"type": "graphql error",
"userError": true,
"exception": {
"message": "Argument Validation Error",
"locations": [
{
"line": 1,
"column": 80
}
],
"path": [
"customerNeedCreate"
],
"extensions": {
"code": "BAD_USER_INPUT",
"validationErrors": [
{
"target": {
"customerId": "5ae1a484-af7e-48aa-b32e-3d327ec599eb",
"issueId": "28bf8fe5-5aac-4a1d-9fd0-057a1e9d6fdd",
"attachmentId": "12",
"body": "Content of the request",
"attachmentUrl": "https://"
},
"value": "12",
"property": "attachmentId",
"children": [],
"constraints": {
"isUuid": "attachmentId must be a UUID"
}
},
{
"target": {
"customerId": "5ae1a484-af7e-48aa-b32e-3d327ec599eb",
"issueId": "28bf8fe5-5aac-4a1d-9fd0-057a1e9d6fdd",
"attachmentId": "12",
"body": "Content of the request",
"attachmentUrl": "https://"
},
"value": "https://",
"property": "attachmentUrl",
"children": [],
"constraints": {
"customValidation": "attachmentUrl is not a valid URL"
}
}
]
}
}
}
}
],
"data": null
Hello, is CustomerNeed the same as Linear's Customer Request? |
Yes. You can find more documentation about the Customers data models here. |
Adding support for
CustomerNeed
entity (Create, Trigger).