Is it OK to mount outdoor electrical outlet box to deck trim board?
As long as you can secure the box rigidly to the trim board in accordance with the box's listing and the trim board itself isn't flopping in the breeze, you have it made according to 314.23(A):


  (A) Surface Mounting. An enclosure mounted on a building or other surface shall be rigidly and securely fastened in place. If the surface does not provide rigid and secure support, additional support in accordance with other provisions of this section shall be provided.