I am trying to create a user record based on other record getting created, I added all the code in apex class and I am trying to call apex code method in my trigger. I am getting incorrect signature error.

my apex class code signature is
public static void CreateUser(List<User> ur)

and I am calling this method in my trigger like
Usercreation_controller.CreateUser (Trigger.new);

I tried to pass arguments as ur. I am able to save the code, but the user record is not getting created

  • 4
    Can you add your relevant code here? In its current form you have discrepancies in the title and the contents so its not very clear where the issue is. Providing some details will help anyone to be able to help you. – Jayant Das Apr 8 '19 at 14:12

According to your question title, you are trying to access CreateUse(...) instead of CreateUser(...) mentioned in your apex class.

But it would be kind of you to add code in the description.


From the limited information available, here are the few things you need to correct

  • From the question's title, it says that you are calling CreateUse whereas the method name is CreateUser. Anyhow, I hope this is just a typo as it wouldn't have compiled and wouldn't have allowed you to save the code.

  • From the question's title, it says that you are passing List<Ent_Req__c> to CreateUser method whereas you should pass List<User>. Assuming that you have a trigger on Ent_Req__c object, so Trigger.New will contain the List<Ent_Req__c> and not List<User> which is what is expected for CreateUser method.

So, you will have to perform either of the below two options

  • Change your methods signature to accept List<Ent_Req__c> and construct List<User> that needs to be inserted and perform DML in your method.

  • Construct the List<User> from List<Ent_Req__c> in your trigger and then pass List<User> to CreateUser method of your class to perform DML or any other logic that needs to be implemented.

Not the answer you're looking for? Browse other questions tagged or ask your own question.