Skip to main content
Decision against Salesforce Data
James Gilray avatar
Written by James Gilray
Updated over a week ago

This article will show you how set a field in Salesforce conditional on existing data inside Salesforce. In this example, we will set the custom field field Lead Source (LeadSource) on the Contact record but only if a value does not already exist for that field.

Create Flow

To create your Flow, go to Setup → Process Automation → Flows and click New Flow. Select Autolaunched Flow (No Trigger) from the available options and click Create.

Create Record Variable

Open Toolbox and click New Resource. Create a new resource with the following information:

Item

Value

Comment

Resource Type

Variable

API Name

Record

Autogenerated

Data Type

Record

Object

Contact

The object this Flow relates to

Available for Input

True

Available for Output

True

Add Decision

In your Flow click the + icon to add a new Element and select Decision. Configure your decision with the following information:

Item

Value

Comment

Label

Check Lead Source

API Name

Check_Lead_Source

Autogenerated

Outcome Label

Exists

Outcome API Name

Exists_Lead_Source

Autogenerated

Resource

{!Record.LeadSource}

  • Record is the object the decision is to apply to (in this case the Contact record)

  • LeadSource is the field the decision is to apply to

Operator

Is Null

The logic the decision is to use

Value

{!$GlobalConstant.False}

The logic the decision is to use

Your Flow should now look like:

Assign Value

Since you only want to perform your assignment if the field Lead Source does not already exist, you can add your assignment under the Default Outcome branch.

In your Flow click the + icon to add a new Element and select Assignment. Configure your assignment with the following information:

Item

Value

Comment

Label

Set Lead Source

API Name

Set_Lead_Source

Autogenerated

Variable

{!Record.LeadSource}

  • Record is the object the logic is to apply to (in this case the Contact record)

  • LeadSource is the field the logic is to apply to

Operator

Equals

Value

Raisely

  • The value the logic is to set

  • The value to set is up to you and Raisely is used for demonstration purposes only

Your Flow should now look like:

Save Flow

You can now save your Flow. Naming conventions are not of importance but for the framework we use please see equivalent section in the article Assign a Default Value. In this scenario we would set:

Item

Value

Flow Label

[MoveData Extension] Donation: Contact - Mapping

Flow API Name

MoveData_Donation_Contact_Mapping_Ext

Create Field Set

Whenever you are decisioning against Salesforce data, you must add the relevant field into the field set.

To create your field set, go to Setup → Object Manager → [Object] → Field Sets and click New. The naming convention is not used by the integration, but we recommend applying a format which mimics the MoveData Field Sets:

Item

Value

Field Set Label

[MoveData Extension] Donation: Contact Fieldset

Field Set Name

MoveData_Donation_Contact_Fieldset_Ext

Where is this used?

MoveData

Add Field to Field Set

You can now add your field to your field set:

Register Flow in MoveData Pipeline

You will now need to register your Flow in the MoveData Pipeline. For instructions on how to do this please see Assign a Default Value - Register Flow in MoveData Pipeline. In this scenario we would clone PIPELINE_DONATION_CONTACT_MAPPING and set the following values:

Item

Value

Comment

Handler

MoveData_Donation_CONTACT_Mapping_Ext

API Name of your Flow

Type

Flow

Label

PIPELINE_DONATION_CONTACT_MAPPING

MoveData Pipeline Setting Name

DONATION_CONTACT_MAPPING_EXT

Order

6

Register Field Set in MoveData Pipeline

To register your field set, go to Setup → Custom Code → Custom Metadata Types and click Manage Records next to MoveData Pipeline Setting.

We recommend finding the existing entry which points to the Managed Field Set your newly developed Field Set will be running alongside of. In this case it is DONATION_CONTACT_FIELDSET_001. Open the entry and click Clone.

Configure your metadata entry with the following information and click Save:

Item

Value

Comment

Handler

MoveData_Donation_Contact_Fieldset_Ext

API Name of your Field Set

Type

Fieldset

Label

PIPELINE_DONATION_CONTACT_FIELDSET

MoveData Pipeline Setting Name

DONATION_CONTACT_FIELDSET_EXT

Order

6

Your Field Set is now registered in MoveData.

Reprocess Notification

You can now open a relevant notification and click Reprocess. Observe that the value Raisely is set in the execution log and resultant record:

If you change the field to some other value and reprocess the notification you will notice it does not update to Raisely due to the decision to perform the assignment only if a value does not already exist for the field Lead Source.

Did this answer your question?