File tree 4 files changed +18
-4
lines changed
apps/web/public/static/locales/en
4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 2826
2826
"single_select" : " Single Select" ,
2827
2827
"multi_select" : " Multi Select" ,
2828
2828
"group_meeting" : " Group Meeting" ,
2829
+ "salesforce_ignore_guests" : " Do not create new records for guests added to the booking" ,
2829
2830
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS" : " ↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
2830
2831
}
2831
2832
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({
39
39
const sendNoShowAttendeeDataField = getAppData ( "sendNoShowAttendeeDataField" ) ?? "" ;
40
40
const onBookingWriteToRecord = getAppData ( "onBookingWriteToRecord" ) ?? false ;
41
41
const onBookingWriteToRecordFields = getAppData ( "onBookingWriteToRecordFields" ) ?? { } ;
42
+ const ignoreGuests = getAppData ( "ignoreGuests" ) ?? false ;
42
43
43
44
const { t } = useLocale ( ) ;
44
45
@@ -135,6 +136,16 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({
135
136
} }
136
137
/>
137
138
</ div >
139
+ < div className = "mb-4" >
140
+ < Switch
141
+ label = { t ( "salesforce_ignore_guests" ) }
142
+ labelOnLeading
143
+ checked = { ignoreGuests }
144
+ onCheckedChange = { ( checked ) => {
145
+ setAppData ( "ignoreGuests" , checked ) ;
146
+ } }
147
+ />
148
+ </ div >
138
149
{ createEventOnSelectedOption . value === SalesforceRecordEnum . CONTACT ? (
139
150
< div >
140
151
< Switch
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export const appDataSchema = eventTypeAppCardZod.extend({
35
35
sendNoShowAttendeeDataField : z . string ( ) . optional ( ) ,
36
36
onBookingWriteToRecord : z . boolean ( ) . optional ( ) ,
37
37
onBookingWriteToRecordFields : z . record ( z . string ( ) , writeToRecordEntry ) . optional ( ) ,
38
+ ignoreGuests : z . boolean ( ) . optional ( ) ,
38
39
} ) ;
39
40
40
41
export const appKeysSchema = z . object ( {
Original file line number Diff line number Diff line change @@ -29,17 +29,18 @@ export default class CrmManager {
29
29
30
30
public async createEvent ( event : CalendarEvent , appOptions ?: any ) {
31
31
const crmService = await this . getCrmService ( this . credential ) ;
32
- const { skipContactCreation } = crmService ?. getAppOptions ( ) || { } ;
32
+ const { skipContactCreation = false , ignoreGuests = false } = crmService ?. getAppOptions ( ) || { } ;
33
+ const eventAttendees = ignoreGuests ? [ event . attendees [ 0 ] ] : event . attendees ;
33
34
// First see if the attendees already exist in the crm
34
- let contacts = ( await this . getContacts ( { emails : event . attendees . map ( ( a ) => a . email ) } ) ) || [ ] ;
35
+ let contacts = ( await this . getContacts ( { emails : eventAttendees . map ( ( a ) => a . email ) } ) ) || [ ] ;
35
36
// Ensure that all attendees are in the crm
36
- if ( contacts . length == event . attendees . length ) {
37
+ if ( contacts . length == eventAttendees . length ) {
37
38
return await crmService ?. createEvent ( event , contacts ) ;
38
39
}
39
40
40
41
if ( skipContactCreation ) return ;
41
42
// Figure out which contacts to create
42
- const contactsToCreate = event . attendees . filter (
43
+ const contactsToCreate = eventAttendees . filter (
43
44
( attendee ) => ! contacts . some ( ( contact ) => contact . email === attendee . email )
44
45
) ;
45
46
const createdContacts = await this . createContacts (
You can’t perform that action at this time.
0 commit comments