function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MattMet86MattMet86 

fieldsToNull - Multiple Values

Can anyone tell me the proper syntax for the fieldsToNull value?

Problem:
I need to null out three custom date fields; Term_Date__c, Audit_Date__c, Benefit_Ineligibility_Date__c

Current Workaround:
I currently pass all records from my source to Salesforce and call the fieldsToNull for each record in the source and I can only populate one value in the fieldsToNull each time. This results in me having to run the entire data set through 3 times to null out all three fields.

Attempted Tweak:
I attempted to tweak my code a bit and reduced the data set down so I only call the records that actually need these fields nulled but now I am getting this error message.
false Adeptia_ID__c Duplicate external id specified: pio000010006 DUPLICATE_VALUE false 
false Adeptia_ID__c Duplicate external id specified: pio000010006 DUPLICATE_VALUE false 
false Adeptia_ID__c Duplicate external id specified: pio000010006 DUPLICATE_VALUE false

Hopefull Resolution:
I want to be able to call fieldsToNull one time for each record and pass a value of 'Term_Date__c, Audit_Date__c, Benefit_Ineligibility_Date__c'

Best Answer chosen by MattMet86
MattMet86MattMet86
I figured it out, I found a post from nicks.infowelders about something called like JitterBit that led me to find the solution. You aren't passing one string value that has all three values as part of the string. You are passing fieldstonull multiple times for the same record and putting the three individual fields in as values.

I am using an ETL tool called Adeptia, like Informatica, for processing census data and loading that into Salesforce.

Here is an example screen shot if any other Adeptia user ever runs into this issue.  I used the clone node command on the element to create the 1 and 2.

User-added image

All Answers

Hermes YanHermes Yan
Your error is indicating a duplicate value in an external id field. The fields your setting may be associated to that external id field via trigger or workflow that you may not be aware of.
MattMet86MattMet86
I know why that error showed up. I called the same External ID multiple times in one call to Salesforce. This is a sub issue caused by my bigger issue of the fieldsToNull multi value issue.
Hermes YanHermes Yan
From the documentation, that method takes in an array of string of the field names. You should be able to create a string array containing the 3 field names and then pass that array into the method call.
MattMet86MattMet86
If I try and pass all three values to that field I get this message.

com.adeptia.indigo.services.ServiceException: INVALID_FIELD: No such column 'Audit_Date__c, Term_Date__c, Benefit_Ineligibility_Date__c' on entity 'Employees__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
MattMet86MattMet86
Here is the call to salesforce as well.

<tns:sObjects xsi:type="Employees__c"><ens:fieldsToNull>Audit_Date__c, Term_Date__c, Benefit_Ineligibility_Date__c</ens:fieldsToNull>
<ens:Adeptia_ID__c>PIO000010006</ens:Adeptia_ID__c>
</tns:sObjects>
</tns:upsert>
MattMet86MattMet86
I figured it out, I found a post from nicks.infowelders about something called like JitterBit that led me to find the solution. You aren't passing one string value that has all three values as part of the string. You are passing fieldstonull multiple times for the same record and putting the three individual fields in as values.

I am using an ETL tool called Adeptia, like Informatica, for processing census data and loading that into Salesforce.

Here is an example screen shot if any other Adeptia user ever runs into this issue.  I used the clone node command on the element to create the 1 and 2.

User-added image
This was selected as the best answer