I'm new Salesforce and I'm trying to learn how to use Flows.
Assume a flow where I want to:
- when a CampaignMember is created
- find it's Lead
- find the Lead's Campaign
- find the Lead's Campaign parent Campaign
- 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?