Im passing an array of Ids from my JS into currentUserId,
JS
<apex:form >
<apex:actionFunction action="{! removeFollower }" name="processId" oncomplete="refresh()">
<apex:param assignTo="{! currentUserId }" name="userId" value="" />
</apex:actionFunction>
</apex:form>
EXTENSION
public String[] currentUserId { get; set; }
I want to then loop through EntitySubscription and delete each of them. This method works for single Ids, but I need to edit it to accept multiple Ids.
public PageReference removeFollower() {
try {
for(Integer i = 0; i<currentUserId.length; i++){
EntitySubscription subscription = [SELECT parentId FROM
EntitySubscription
WHERE subscriberId = :currentUserId[i]
AND parentId = :id];
Delete subscription;
}
} catch(Exception ex) {
system.debug('Error: ' + ex);
}
return null;
}
At the moment, I'm getting this error.
Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<String>
Would anyone have any suggestions or advice?