I have a class that looks like this:
public class NWTAttachCMController {
private final static String urlFieldName = 'AttachNWTLetters__c';
private String partnerServerUrl;
private ApexPages.StandardSetController controller;
private List<String> NWTIds = new List<Id>();
public String CMUrl {get; private set;}
public NWTAttachCMController(ApexPages.StandardSetController controller) {
this.controller = controller;
for (DHR_No_Wage_Terms__c NWT : (List<DHR_No_Wage_Terms__c>)controller.getSelected()){
NWTIds.add(NWT.Id);
}
partnerServerUrl = 'https://'+ApexPages.currentPage().getHeaders().get('Host')+'/services/Soap/u/26.0/'+UserInfo.getOrganizationId();
}
public PageReference prepareCMUrl() {
CMUrl = 'https://composer.congamerge.com' +
'?SessionId=' + UserInfo.getSessionID() +
'&ServerUrl=' + partnerServerUrl +
'&Id=' + UserInfo.getUserId() +
'&QueryId=[DHRNoWageTermQ]a3c2R000004JF9PQAW?pv0=' + '\''+ String.join(new List<String>(NWTIds),'\'|\'')+'\'';
return null;
}
}
and it works for a batch that I run that downloads merged templates but when I try to use it to create attachments, it gives the following error.
MALFORMED_QUERY: DHR_No_Wage_Terms__c where Id IN (''a492R0000033AkdQAE','a492R0000033AkcQAE'')
^
ERROR at Row:1:Column:277
expecting a right parentheses, found 'a492R0000033AkdQAE'
Here is the query:
SELECT Id,Account__R.Name,DHR_Employee__r.First_Name__c, DHR_Employee__r.Last_Name__c, DHR_Employee__r.Address1__c, DHR_Employee__r.Address2__c, DHR_Employee__r.City__c, DHR_Employee__r.State__c, DHR_Employee__r.Zip__c, Last_Paid_On__c FROM DHR_No_Wage_Terms__c where Id IN ('{pv0}')
Has anyone run across this or see my error?