The second largest trade union in the UK has urged companies with plans to outsource work abroad to involve unions at an earlier stage or risk long-term staff problems.