Set a local uniform electric field

Dear Geant4 users and experts,
I have a simple geometry: 2 boxes in series, one is filled with air and the other is silicon and I use the second one as a detector. My goal is to introduce a local uniform electric field in the first box.
I’m trying to copy the examples in extended/field but my code doesn’t work. Do you have any advice?
Thank you for your help.