Skip to content

feat(salesforce): exclude Salesforce-assigned bookings from Round Robin calculations#26368

Open
JagjeevanAK wants to merge 4 commits intocalcom:mainfrom
JagjeevanAK:jagjeevan/issue-18216
Open

feat(salesforce): exclude Salesforce-assigned bookings from Round Robin calculations#26368
JagjeevanAK wants to merge 4 commits intocalcom:mainfrom
JagjeevanAK:jagjeevan/issue-18216

Conversation

@JagjeevanAK
Copy link

@JagjeevanAK JagjeevanAK commented Jan 1, 2026

Summary

Add an option in Salesforce app settings to exclude bookings assigned via Salesforce owner lookup from Round Robin fairness calculations. When enabled, only bookings assigned through Round Robin logic will count towards host booking counts.

Fixes #18216

Changes

  • Add excludeSalesforceBookingsFromRR setting to Salesforce app schema
  • Add UI toggle in EventType > Apps > Salesforce settings (only visible for Round Robin event types)
  • Modify BookingRepository.getAllBookingsForRoundRobin to filter out SALESFORCE_ASSIGNMENT bookings
  • Update getLuckyUser service to accept and pass the exclusion flag
  • Update all callers to extract and pass the flag from eventType metadata
  • Add i18n translation strings for the new toggle

Related PRs

This is a reopening of #21861 which was closed due to inactivity. The approach was changed based on reviewer feedback from @CarinaWolli - the setting is now stored in Salesforce app metadata (EventType > Apps tab) rather than as a separate EventType database field.

How it works

  1. When the toggle is enabled in Salesforce app settings for a Round Robin event type
  2. The booking repository filters out any bookings that have AssignmentReasonEnum.SALESFORCE_ASSIGNMENT as their assignment reason
  3. This means bookings where the host was assigned because they own the Salesforce contact/lead don't count towards the Round Robin booking counts
  4. Only bookings assigned through the normal Round Robin algorithm are counted for fairness calculations

Testing

  • Manual testing of the UI toggle
  • Verify bookings with Salesforce assignment reason are excluded when flag is enabled
  • Verify normal Round Robin behavior when flag is disabled

…in calculations

Add option in Salesforce app settings to exclude bookings assigned via
Salesforce owner lookup from Round Robin fairness calculations. When
enabled, only bookings assigned through Round Robin logic will count
towards host booking counts.

Changes:
- Add excludeSalesforceBookingsFromRR setting to Salesforce app schema
- Add UI toggle in EventType > Apps > Salesforce settings
- Modify BookingRepository to filter out SALESFORCE_ASSIGNMENT bookings
- Update getLuckyUser to accept and pass the exclusion flag
- Update all callers to extract and pass the flag from eventType metadata
- Add i18n translation strings for the new toggle

Closes calcom#18216
@vercel
Copy link

vercel bot commented Jan 1, 2026

@JagjeevanAK is attempting to deploy a commit to the cal-staging Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added consumer crm-apps area: crm apps, salesforce, hubspot, close.com, sendgrid Medium priority Created by Linear-GitHub Sync teams area: teams, round robin, collective, managed event-types ✨ feature New feature or request labels Jan 1, 2026
@JagjeevanAK JagjeevanAK marked this pull request as ready for review January 1, 2026 16:53
@JagjeevanAK JagjeevanAK requested a review from a team as a code owner January 1, 2026 16:53
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jan 1, 2026
@graphite-app graphite-app bot requested a review from a team January 1, 2026 16:54
@JagjeevanAK
Copy link
Author

Hey @dhairyashiil this PR is ready from my side

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 11 files

Copy link
Member

@dhairyashiil dhairyashiil left a comment

Choose a reason for hiding this comment

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

Could you please attach video showing the before and after of your changes? In the meantime, I'll mark this as a draft

@dhairyashiil dhairyashiil marked this pull request as draft January 2, 2026 04:01
@JagjeevanAK
Copy link
Author

JagjeevanAK commented Jan 2, 2026

Hey It eas already partially approved if you can see PR referenced to it will add video to it

@JagjeevanAK JagjeevanAK marked this pull request as ready for review January 2, 2026 09:13
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 11 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/app-store/salesforce/components/EventTypeAppCardInterface.tsx">

<violation number="1" location="packages/app-store/salesforce/components/EventTypeAppCardInterface.tsx:494">
P2: Use `htmlFor` instead of `for` to maintain proper label-input association in React.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@JagjeevanAK
Copy link
Author

JagjeevanAK commented Jan 2, 2026

Hey @dhairyashiil I dont have salseforce account for this can you just check the liked PR in description ?

@github-actions
Copy link
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions
Copy link
Contributor

Devin AI is resolving merge conflicts

This PR has merge conflicts with the main branch. A Devin session has been created to automatically resolve them.

View Devin Session

Devin will:

  1. Merge the latest main into this branch
  2. Resolve any conflicts intelligently
  3. Run lint/type checks to ensure validity
  4. Push the resolved changes

If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself.

@github-actions github-actions bot removed the Stale label Jan 13, 2026
@github-actions
Copy link
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Jan 20, 2026
JagjeevanAK and others added 2 commits February 3, 2026 22:50
…face.tsx

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@JagjeevanAK
Copy link
Author

hey @keithwillcode any change to get consumer_key & consumer_secret of salseforce CRM for testing ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync consumer crm-apps area: crm apps, salesforce, hubspot, close.com, sendgrid devin-conflict-resolution ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync size/L Stale teams area: teams, round robin, collective, managed event-types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-4906] Don't count bookings assigned by salesforce ownership for RR

2 participants