An external vendor is requiring to pass an array/list in order to send data from Salesforce Account to their system. They provided me with the code shown under request.setbody, but I am getting an error on 'fields'. Can anyone help?
Line: 6, Column: 1 Invalid identifier ' '. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_'.
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://xxxxxxx/login/sso/salesforce?env=xxxxxxxx&aftSubmitURL=rest/v1/witems.json?namespaceId=SALESFORCE&async=true&addRequiredForms=true');
request.setMethod('POST');
request.setBody('{
"fields" : [ {
"name" : "PARAM.REQUESTGROUP",
"value" : [ "New Account" ]
}, {
"name" : "PARAM.PRODUCTTYPE",
"value" : [ "Direct - Advisory" ]
}, {
"name" : "Account1.Id",
"value" : [ "9999900001" ]
}, {
"name" : "Account1.FirstName",
"value" : [ "John" ]
}, {
"name" : "Account1.LastName",
"value" : [ "AFFOLTER1" ]
}, {
"name" : "Account1.SocSecNumber__c",
"value" : [ "231689353" ]
}, {
"name" : "Account1.SocSecNumber__c",
"value" : [ "231689353" ]
}, {
"name" : "Account1.Rep_Code__c",
"value" : [ "11416001" ]
}, {
"name" : "PARAM.REGTYPE",
"value" : [ "529 Plan" ]
}, {
"name" : "PARAM.VENDOR",
"value" : [ "AMERICAN FUNDS" ]
} ]
}');
setBody
method which is needed when calling that method in Apex