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
Sarah Osburn 3Sarah Osburn 3 

Error: Compile Error: Method does not exist or incorrect signature.....REMOVE(Cc.Id)

Hi All,

I am getting the above error on my trigger (wrote a class and then added the class to my trigger) and I can't figure out how to resolve.  All help is so greatly appreciated!

Error: Compile Error: Method does not exist or incorrect signature: ContactExtIdUpdates.updatecalled.remove(Id) at line 6 column 72

Class:
public with sharing class ContactExtIdUpdates {
    public static set<ID> updatedcalled = new set<id>();
}
Here is the trigger and location of the error:
trigger ContactID on Contact (before insert, before update, after update, after delete)
{
    // creates a "lock" by adding the object Id into the "updatecalled" set of IDs.
    for (Contact Cc : Trigger.New) {
            if (Trigger.isAfter) {
                if (!ContactExtIdUpdates.updatecalled.Contains(Cc.Id)) ContactExtIdUpdates.updatecalled.remove(Cc.Id); //Removes lock once updated <------THIS LINE IS CAUSING ERROR
        } else if (!ContactExtIdUpdates.updatecalled.Contains(Cc.Id)) {//Checks lock, executing code only if no lock
        ContactExtIdUpdates.updatecalled.Add(Cc.Id); //Adds lock
        //


 
Best Answer chosen by Sarah Osburn 3
Dilip_VDilip_V
Hi Sarah,

Remove that boolean varible.
I used that to test the trigger.
No need to change your class.
trigger ContactID on Contact (before insert, before update, after update, after delete)
{
    // creates a "lock" by adding the object Id into the "updatecalled" set of IDs.
    for (Contact Cc : Trigger.New) {
            if (Trigger.isAfter) 
            {
                if (!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id))
                ContactExtIdUpdates.updatedcalled.remove(Cc.Id); 
             } 
             else if(!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id)) 
             {
                 ContactExtIdUpdates.updatedcalled.Add(Cc.Id); 
             } 
        } 
        }

Thanks.

All Answers

Jose ZunigaJose Zuniga
I believe you need to make
    public with sharing class ContactExtIdUpdates  
static.
Sarah Osburn 3Sarah Osburn 3
Thanks for the quick response, Jose, but I thought I already had....?
Jose ZunigaJose Zuniga
the class is not static
Sarah Osburn 3Sarah Osburn 3
Can you help me understand how to make it static.  
Jose ZunigaJose Zuniga
public static class ContactExtIdUpdates {
    public static set<ID> updatedcalled = new set<id>();
}
Sarah Osburn 3Sarah Osburn 3
When I try to make that change, I get a compile error on my class.
Error: Compile Error: ContactExtIdUpdates: Types cannot be marked as static at line 6 column 21
Dilip_VDilip_V
Hello Sarah

Well that's simplae spelling mistake.
ContactExtIdUpdates.updatecalled.remove(Cc.Id); //Wrong
ContactExtIdUpdated.updatecalled.remove(Cc.Id);//Right
The list name defined in the class is updatedcalled not updatecalled.
Use this code.
trigger ContactID on Contact (before insert, before update, after update, after delete)
{
    // creates a "lock" by adding the object Id into the "updatecalled" set of IDs.
    for (Contact Cc : Trigger.New) {
            if (Trigger.isAfter) 
            {
                if (!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id))
                ContactExtIdUpdates.updatedcalled.remove(Cc.Id); 
                 ContactExtIdUpdates.bool=true;
             } 
             else if(!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id)) 
             {
                 ContactExtIdUpdates.updatedcalled.Add(Cc.Id); 
             } 
        } 
        }

Thanks.
Dilip_VDilip_V
Hi Sarah,

Remove that boolean varible.
I used that to test the trigger.
No need to change your class.
trigger ContactID on Contact (before insert, before update, after update, after delete)
{
    // creates a "lock" by adding the object Id into the "updatecalled" set of IDs.
    for (Contact Cc : Trigger.New) {
            if (Trigger.isAfter) 
            {
                if (!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id))
                ContactExtIdUpdates.updatedcalled.remove(Cc.Id); 
             } 
             else if(!ContactExtIdUpdates.updatedcalled.Contains(Cc.Id)) 
             {
                 ContactExtIdUpdates.updatedcalled.Add(Cc.Id); 
             } 
        } 
        }

Thanks.
This was selected as the best answer
Naveen IlaNaveen Ila
@Sarah : 

There is no such variable "updatecalled" in the class ContactExtIdUpdates .

you have updatedcalled. See the difference between these to names. 

Static in salesforce works for context. 






 
Sarah Osburn 3Sarah Osburn 3
Thank you, @Dilip!