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
NetmasterNetmaster 

Create my API

Hello,

 

I use in my force.com application Apex Classes, and many of them have the same structure, I want to make an API to reuse it after.

 

For exaple, these are two classes :

 

public class insererActAct{

    public List<Activites_actuelles__c> accts {get; set;}
    
    public insererActAct(ApexPages.StandardController controller){
        accts = new List<Activites_actuelles__c>();
        accts.add(new Activites_actuelles__c());
    }
    
    public void addrow(){
        accts.add(new Activites_actuelles__c());
        
    }
    
    public PageReference deleteRow(){
       if (accts.size()>1)
       {
          accts.remove(accts.size()-1);
       }
       return null;
    }
    
    public PageReference save()
    {
        insert accts;
        Assure__c theParent = new Assure__c(id=accts[0].Activites_actuelles__c);
        PageReference acctPage = new ApexPages.StandardController(theParent).view();
        acctPage.setRedirect(true);
        return acctPage;
    }
}

 

public class insererEnfants{

    public List<Enfants__c> accts {get; set;}
    
    public insererEnfants(ApexPages.StandardController controller){
        accts = new List<Enfants__c>();
        accts.add(new Enfants__c());
    }
    
    public void addrow(){
        accts.add(new Enfants__c());
        
    }
    
    public PageReference deleteRow(){
       if (accts.size()>1)
       {
          accts.remove(accts.size()-1);
       }
       return null;
    }
    
    public PageReference save()
    {
        insert accts;
        Assure__c theParent = new Assure__c(id=accts[0].Parent__c);
        PageReference acctPage = new ApexPages.StandardController(theParent).view();
        acctPage.setRedirect(true);
        return acctPage;
    }
}

 

Can any one tell me it is possible or not, if yes, how can I do this, please ?

kiranmutturukiranmutturu

i didnt get u properly...do u want to make them as a webservices or wat?

NetmasterNetmaster

I want to make a standard object with input and output, because I will use this object many times.