Adding a record to a parent

First of all, create a Text variable in your Flow to pass the campaign ID to auto-relate leads with a campaign. Then, we will use a custom button to invoke the Flow and pass the campaign ID to the Text variable. To do this, follow these instructions:

  1. Open the Create Leads Flow that we created in the previous case.
  2. Create a Text variable VarTCampaignID, set Input/Output Type as Input and Output, and for Default Value, use {!$GlobalConstant.EmptyString}.
  3. Drag and drop the Record Create element onto the canvas; this will open a new window. Now, enter Add to Campaign as Name, and Unique Name will be autopopulated based on the name. Select the CampaignMember object and the map object fields LeadId with the {!VarTLeadID} variable and CampaignId with the {!VarTCampaignID} variable, as shown in the following screenshot:

You can also save the newly created record ID in a variable and refer to it anywhere in the Flow.

The current user must have "Marketing User" on their user so they can access Campaign records. The CampaignMember object represents the relationship between a campaign and either a lead or a contact. For more details, visit, https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_campaignmember.htm.
  1. Once you are done, click on the OK button.
  2. Use a connector to connect to the Record Create element, Create lead record, and the Record Create element Add to Campaign, as shown in the following screenshot:
  3. Save your Flow and close the Flow Designer using the Close button. This will redirect you to the Flow Detail page.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.188