Skip to content

Commit c6a9303

Browse files
committed
Update contact use case
1 parent 70ddc68 commit c6a9303

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Umbraco.Forms.Integrations.Crm.ActiveCampaign/ActiveCampaignContactsWorkflow.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context
4343

4444
var contacts = _contactService.Get(email).Result;
4545

46-
var result = _contactService.CreateOrUpdate(new ContactRequestDto
47-
{
48-
Contact = contacts.Contacts.Count > 0
49-
? contacts.Contacts.First() : Build(context.Record)
50-
},
51-
contacts.Contacts.Count > 0).Result;
46+
var requestDto = new ContactRequestDto { Contact = Build(context.Record) };
47+
if (contacts.Contacts.Count > 0) requestDto.Contact.Id = contacts.Contacts.First().Id;
48+
49+
var result = _contactService.CreateOrUpdate(requestDto, contacts.Contacts.Count > 0).Result;
5250

5351
if (!result) return WorkflowExecutionStatus.Failed;
5452

0 commit comments

Comments
 (0)