I have a JSON and I need to pass the data to a list, then use it as my class parameter.

I've managed to pass JSON to a List, but when I put it in the class, it throws the following error:

"global methods do not support parameter type of List<contractFat.Contract>"

My code:

global  class contractFat { 

public class ContractJSON {

    public List<Contract> Contract;

    public class Contract {
        public String idSalesForce;
        public String dtEmissao;
        public String nrContrato;
        public String vlVenda;
        public String vlDevolucao;
        public String qtTotalClientes;
        public String qtClientesAtivosMes;
        public String flagMensal;

    public  ContractJSON parse(String json) {
        return (ContractJSON) System.JSON.deserialize(json, ContractJSON.class);
    global static String updateFaturamento(List<Contract> Contratos)
    RestRequest req = RestContext.request; 
    RestResponse res = RestContext.response;

Can anyone help me with this problem?


BTW - it's asking for trouble if you want to name an inner class "Contract" since this is also the name of a standard SObject.

But the error message is because contractFat.Contract has only public visibility yet it's used as a parameter in a global method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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