I am constructing a media built in and due to the framing one of the interior walls of the cabinet will lay across an existing electrical outlet and will be 3-1/2 inches out from the existing wall. I was wondering what the best method would be to do this to meet code. I am considering installing a new second box (attached to the frame of the built in) outward from the first box that is flush with the existing wall, and using small extension wires and wire nuts to relocate the outlet flush with the interior of the media built in cabinet. Would this meet code? Is there a better or simpler way?
You'll have to move the electrical box
You can't entrap an electrical junction box behind built-in furniture like that. Every box cover must be accessible without tools (obviously you need a screwdriver to remove the box cover itself, but those are the only screws you are allowed to turn).
Further, you cannot splice anywhere but a junction box, and again, junction boxes must be accessible.
So lining up the framing of the cabinet with the electrical box is not really an option. The framing must move, or the box must move.
If you have a flat space on your built-in cabinet that aligns with the existing box, you could just stack box extensions to get where you need.