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

LeadDupePreventerTests.apex Cookbook Sample Produces Error
Produces the following error when I try to implement:

Error: Compile Error: Comparison arguments must be compatible types: Schema.SObjectField, String at line 47 column 45

Message Edited by JAW99 on 10-06-2008 12:09 PM
It looks like, at least with Apex version 13 and on, that System.DMLException.getDmlFields() returns an System.SObjectField[] instead of String[].

I haven't played with tokens yet (which is what System.SObjectField is) but I think you need to replace

System.assert(e.getDmlFields(0)[0] == 'Email');


System.assert(e.getDmlFields(0)[0] == Lead.Email);


Thanks very much, it seems to be working.
The wiki should probably be updated, too. I guess I'll leave a note there.