Our view is that the early referral of matters to mediation is a good idea in that resources which could be spent on arbitration or litigation can be spent towards resolving the dispute.
Therefore including a mediation clause in your commercial agreements which requires mediation before litigation or arbitration is very sensible.
Even without such a clause you can agree with the other party to have a mediation at any time both before or during litigation.
Most jurisdictions require at least one mediation process as part of the litigation process.
Unfortunately, without early neutral evaluation the parties are unable to properly assess their propects at trial until just before trial and hence sometimes a mediation just before trial can be effective.