cancel
Showing results for 
Search instead for 
Did you mean: 

Import - Modify with a Formula: Is Conditional update using another field possible?

michael-wtds
Frequent Contributor

Is there a way to conditionally update fields using 'Modify with a Formula' in DemandTools, specifically choosing either the import file's value or the existing Salesforce value based on certain criteria?

Example Scenario:
I want to update the Phone field on Contact records, but only if the custom field Producer__c is false.

My initial approach:

  • Disabled "Allow Blank Override"

  • Set field mapping for Phone as "Update if Empty"

  • Used this formula:
    IF(${Producer__c}, "", NaPhoneFix(${Phone}))

Additionally, if this logic can work, I'd like to apply similar conditional logic to Mailing City, Mailing State, and Mailing Zip. Specifically, these fields should only update if the Mailing Street in Salesforce is currently blank. The concern here is that using a simple "update if blank" setting might inadvertently insert a zip code, or another maing field value, into an incomplete existing address, creating invalid address combination.

Typically, I'll use Tableau Prep to do field level comparisons, but this requires exporting the match results first, and then creating a new import file.  So, it would be great if there's a way to handle this in the Import formulas.

Thanks in advance for any help!
Michael

 

5 REPLIES 5

Pugs_Validity
Validity Team Member
Validity Team Member

@michael-wtds  - You won't be able to reference in that way within Import. I would condition and run the update twice or first use Match to identify them. 

Hi @Pugs_Validity, here's a video clip showing how it appears to be working in the preview results using CreatedDate -

michaelwtds_0-1754659073754.png

Import - Modify Contact Source based on Created Date 

 

 

beavery
Observer

Hi @Pugs_Validity and @michael-wtds ,

I have a somewhat similar use case would love input on. I would like to update a "Data Source" field on an Upsert import *only* if the record is being created as new. This is a field that aims to capture the platform from which the record was created, so always update would not work as we don't want to overwrite. But "update if empty" is too broad as existing records that are blank shouldn't necessarily have this value. Any record that is created net new in the import (as opposed to matching to an existing) however *should* have the value. Is there a way to achieve that via a match setting + formula setting? Thanks

CC: @jcrandall 

michael-wtds
Frequent Contributor

Hi @beavery,

Let me know if this works -

On your field, add a formula to compare the created date > Today() - 1 (1 day ago), or maybe NOW()- (1/24) (1 hour ago).  If true udate with the mapped field value.   If false, then blank.  Then use Update If Empty.

IF(${CreatedDate} > Today()-1, ${Contact_Source_Details__c}, "")

Pugs_Validity
Validity Team Member
Validity Team Member

@beavery - Is the Data Source field on your import source? All you should need to do in that event is set the step one condition to "Do Not Update" for the Data Source field. These conditions only apply to record matches, not newly created records from your Final Match step. 

Pugs_Validity_0-1754689369091.png