One way to do it:
Add a boolean variable to the object.
on collision with wall - if variable is true - set solid enabled
on collision with wall - if variable is not true - set solid disabled
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..