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


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"});
| improve this answer | |
  • 1
    cheers.. its always simple mistakes – SLM3573 Nov 2 '17 at 12:41

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.