Skip to main content

Not sure what I’m doing wrong here, I’m getting a an error 400 bad request when passing a single Attachment Id to to this class:


global class AttachmentsDelete {
@InvocableMethod(label='Delete Attachments')
global static void deleteAttachment(List<Attachment> attachIds) {

List <Attachment> attachmentsToDelete = eSELECT Id FROM Attachment WHERE Id IN :attachIds];

delete attachmentsToDelete;
}

}

it seems like it might be skuid’s using the apex custom action with a wrong URL?

I’m away from my desk today, but I think you also need an Invocable Parameter. It will also be a list. I’ve not written much apex, but I haven’t used a List in an IN clause; you may need to write the code with a loop even though you only expect the parameter to contain one Id.


Thanks Mike! I did have a version with an @InvocableVariable, and was still getting the bad request error, and no returned error message. I ended up just putting the above code in a webservice and using sforce.apex.execute and it works fine that way.