Skip to content

Commit b7e860c

Browse files
committed
AP-7104 # Added salesforce picklist dynamic options
1 parent 5967780 commit b7e860c

4 files changed

Lines changed: 85 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- salesforce picklist dynamic options
13+
1014
### Fixed
1115

1216
- github action permissions to allow docs and github release jobs

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@emotion/react": "^11.14.0",
1313
"@emotion/styled": "^11.14.1",
1414
"@nylas/react": "^3.1.2",
15-
"@oneblink/sdk-core": "^9.0.0",
15+
"@oneblink/sdk-core": "^9.1.0-beta.2",
1616
"@oneblink/storage": "^5.0.0-beta.2",
1717
"@react-google-maps/api": "^2.20.8",
1818
"@react-input/mask": "^2.0.4",

src/apps/form-service.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,78 @@ async function getFormElementOptionsSetOptions(
620620
}
621621
}
622622
}
623+
case 'SALESFORCE_PICKLIST': {
624+
const formElementOptionSetEnvironmentSalesforcePicklist =
625+
formElementOptionsSet.environments.find(
626+
(environment) =>
627+
environment.formsAppEnvironmentId === formsAppEnvironmentId,
628+
)
629+
if (!formElementOptionSetEnvironmentSalesforcePicklist) {
630+
return {
631+
type: 'ERROR',
632+
error: new OneBlinkAppsError(
633+
`Dynamic list configuration has not been completed yet. Please contact your administrator to rectify the issue.`,
634+
{
635+
title: 'Misconfigured Dynamic List',
636+
originalError: new Error(
637+
JSON.stringify(
638+
{
639+
formElementOptionsSetId: formElementOptionsSet.id,
640+
formElementOptionsSetName: formElementOptionsSet.name,
641+
formsAppEnvironmentId,
642+
},
643+
null,
644+
2,
645+
),
646+
),
647+
},
648+
),
649+
}
650+
}
651+
652+
try {
653+
const { options } = await getRequest<{ options: unknown }>(
654+
`${tenants.current.apiOrigin}/forms/${formId}/salesforce-picklist-options?formElementOptionsSetId=${formElementOptionsSet.id}`,
655+
abortSignal,
656+
)
657+
return {
658+
type: 'OPTIONS',
659+
options,
660+
}
661+
} catch (error) {
662+
Sentry.captureException(error)
663+
return {
664+
type: 'ERROR',
665+
error: new OneBlinkAppsError(
666+
`Options could not be loaded. Please contact your administrator to rectify the issue.`,
667+
{
668+
title: 'Invalid List Response',
669+
httpStatusCode: (error as HTTPError).status,
670+
originalError: new OneBlinkAppsError(
671+
JSON.stringify(
672+
{
673+
formsAppEnvironmentId,
674+
formElementOptionsSetId: formElementOptionsSet.id,
675+
formElementOptionsSetName: formElementOptionsSet.name,
676+
salesforceObject:
677+
formElementOptionSetEnvironmentSalesforcePicklist.object
678+
.label,
679+
salesforceField:
680+
formElementOptionSetEnvironmentSalesforcePicklist.field
681+
.label,
682+
},
683+
null,
684+
2,
685+
),
686+
{
687+
originalError: error as HTTPError,
688+
},
689+
),
690+
},
691+
),
692+
}
693+
}
694+
}
623695
case 'GOOD_TO_GO_CUSTOM_FIELD': {
624696
const formElementOptionSetEnvironmentGoodToGoCustomField =
625697
formElementOptionsSet.environments.find(

0 commit comments

Comments
 (0)