0

I'm new Salesforce and I'm trying to learn how to use Flows.

Assume a flow where I want to:

  1. when a CampaignMember is created
  2. find it's Lead
  3. find the Lead's Campaign
  4. find the Lead's Campaign parent Campaign
  5. if the Lead's Campaign parent Campaign's name is "Avi 2023" or "Avi 2022" then set the Lead's Campaign's name to "Avi"

I've spent days trying to figure out how to assign this.

I've tried assigning the record to a variable, but I consistently get the error "wrong data type" and flow UI only allows me to input Campaign.Id, which can only be put into a variable of type text, but I don't see how I can later use that Campaign.Id to to an update.

I've tried every kind of variable and update and assignment.

It seems like the Flow UI allows one distance of relationship (CampaignMember.Lead) but no further than that.

Any suggestions?

UPDATE:

Okay, I did more research on this. It seems there is no direct link between the Lead and the Campaign. However, we have a custom field called Most_Recent_Campaign__c and that sometimes holds the id of the campaign to which the Lead belongs. So I guess my real question is, can use a flow to take that id and get the Campaign, then the parent campaign, check the name, then update the Campaign? Or do I need to write custom Apex code for that?

7
  • 1
    Have you defined relation between lead and Campaign? Can you also share the flow which you have tried. Feb 27 at 8:29
  • How do I share a Flow? How do I copy it? Feb 27 at 13:53
  • "Have you defined relation between lead and Campaign?" I thought this was a built-in default? Are you saying I need to add additional information about the hierarchy? Feb 27 at 14:07
  • You can share the screenshots of the flow Feb 28 at 2:28
  • Okay, I did more research on this. It seems there is no direct link between the Lead and the Campaign. However, we have a custom field called Most_Recent_Campaign__c and that sometimes holds the id of the campaign to which the Lead belongs. So I guess my real question is, can use a flow to take that id and get the Campaign, then the parent campaign, check the name, then update the Campaign? Or do I need to write custom Apex code for that? Feb 28 at 10:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.