I need to Prevent inserting attachment if parent record's status is "Closed". I have tried with before insert where i couldn't get parentid so it is not working. Any directions/suggestions will greatly appreciated.
Create a Trigger on ContentDocumentLink object which is related to your Parent record using LinkedEntityId field. You may try to use
addError method on SObject to prevent DML operation from occurring, but I'm not sure other records (ContentDocument and ContentVersion) won't be created. If they will, you may throw a custom exception with a meaningful message.