Skip to content
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

feat: Salesforce RR skip based on a user on a lookup field on an account #17526

Merged
merged 24 commits into from
Nov 12, 2024

Conversation

joeauyeung
Copy link
Contributor

@joeauyeung joeauyeung commented Nov 7, 2024

What does this PR do?

This PR allows users to add a route under a routing form to look up a user under a custom lookup field under a Salesforce account. If that user is a part of the round robin event, then directly book with that user.

image

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

https://www.loom.com/share/db809cd26f56481299eac1a4067c885c?sid=940ebec9-021a-4ee4-876d-3bd86486d235

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Enable Salesforce in an round robin event type
  • Go to an event type and choose the option to route to a lookup field under Salesforce
  • Enter the field name of the lookup field under a Salesforce account
  • Fill out the routing form with an email domain that exists under the account
    • It should route to that user
  • Fill out the routing form with an email that doesn't exist under an account
    • It should follow the attribute routing

@keithwillcode keithwillcode added consumer core area: core, team members only labels Nov 7, 2024
import { RouteActionType } from "../../zod";

type FormFieldsQueryBuilderState = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move types to the types file so they can be used in other components

Comment on lines 424 to 435
{eventTypeRedirectUrlSelectedOption?.eventTypeAppMetadata &&
"salesforce" in eventTypeRedirectUrlSelectedOption.eventTypeAppMetadata ? (
<div className="mt-4 px-2.5">
<DynamicAppComponent
componentMap={routingFormAppComponents}
slug="salesforce"
appData={eventTypeRedirectUrlSelectedOption?.eventTypeAppMetadata["salesforce"]}
route={route}
setAttributeRoutingConfig={setAttributeRoutingConfig}
/>
</div>
) : null}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Make this more dynamic and not hard code "salesforce" here

packages/app-store/salesforce/zod.ts Show resolved Hide resolved
Comment on lines 200 to 212
const eventTypeAppMetadataParse = EventTypeAppMetadataSchema.safeParse(eventType.metadata?.apps);
const eventTypeAppMetadata: Record<string, any> = {};
if (eventTypeAppMetadataParse.success) {
const appMetadata = eventTypeAppMetadataParse.data;

if (appMetadata) {
for (const appSlug of Object.keys(appMetadata)) {
if (enabledAppSlugs.includes(appSlug)) {
eventTypeAppMetadata[appSlug] = appMetadata[appSlug as keyof typeof appMetadata];
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is in draft but still leaving code feedback.

Let's abstract it out

Copy link

vercel bot commented Nov 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 0:48am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 0:48am

Co-authored-by: Alex van Andel <[email protected]>
@graphite-app graphite-app bot requested a review from a team November 11, 2024 16:32
emrysal
emrysal previously approved these changes Nov 11, 2024
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with this, thanks for your time to walk me through it; lgtm 🚀

Copy link

socket-security bot commented Nov 11, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

View full report↗︎

Copy link
Contributor

github-actions bot commented Nov 12, 2024

E2E results are ready!

@emrysal emrysal merged commit 49333ad into main Nov 12, 2024
38 checks passed
@emrysal emrysal deleted the salesforce-route-to-user-lookup-field branch November 12, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only crm-apps area: crm apps, salesforce, hubspot, close.com, sendgrid ✨ feature New feature or request ready-for-e2e routing-forms area: routing forms, routing, forms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants