I am trying to create a small prototype to basically construct a json message from a button call.

I have button code


var xx = "{!URLENCODE(Zuora__SubscriptionProductCharge__c.Id)}"
var json = sforce.apex.execute("SendConfig", "SendCharge"{ChargeId:"xx"})


and class

   global with sharing class SendConfig{

   webservice static string SendCharge(string ChargeId)


    Zuora__SubscriptionProductCharge__c chrg = [Select Access_Token__c,CODE_Filter__c,IP_Restrictions__c from Zuora__SubscriptionProductCharge__c where Id =:ChargeId Limit 1] ;

   JSONGenerator gen = JSON.createGenerator(true);   

   gen.writeStringField('Token ', chrg.Access_Token__c);
   gen.writeStringField('CFE Code',chrg.CODE_Filter__c);
   gen.writeStringField('IP Addresses',chrg.IP_Restrictions__c);

   String jsonS = chrg.getAsString();





but I am getting an error that there is a missing ) after argument list, I saw some issues about this being encoding so I am even doing URLENCODE but I am not using URL so that cant be it. I dont see where the missing bracket should be

1 Answer 1


You are missing a comma, In this line

sforce.apex.execute("SendConfig", "SendCharge"{ChargeId:"xx"})

Add the comma here

sforce.apex.execute("SendConfig", "SendCharge",{ChargeId:"xx"});
  • 1
    cheers.. its always simple mistakes
    – SLM3573
    Commented Nov 2, 2017 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .