Companies in recent years have found a powerful marketing tool in social media. But some have also discovered it’s not all that uncommon for things to go wrong. A recent tweet from McDonald’s Corp. that took aim at President Donald Trump is just the latest example.

How are in-house lawyers reacting to avoid missteps? By planning ahead, training employees and even offering on-call vetting for certain social media messages.