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
JAW99JAW99 

LeadDupePreventerTests.apex Cookbook Sample Produces Error

http://wiki.apexdevnet.com/index.php/LeadDupePreventerTests.apex
http://wiki.apexdevnet.com/index.php/LeadDupePreventerTests.apexhttp://wiki.apexdevnet.com/index.php/LeadDupePreventerTests.apex
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
ctonectone
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

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

 with

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

 --Chris

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