I was wrong. I predicted that a deal to export 2000 tons of seed potatoes from Scotland to Russia, which was facilitated by the Scottish Government, would go ahead despite all the controversy and despite the war in Ukraine. But as I say: I was wrong. And that’s a good thing.

In case you missed it, here’s what happened. Earlier this month, PepsiCo’s CEO Ramon Laguarta announced that, as a result of the war, the company would be suspending the sale of Pepsi-Cola and its other drinks in Russia. You may also remember that, around about the same time, the Scottish Finance Secretary Kate Forbes called on businesses to suspend all their Russian trade. “Everyone wants to do the right thing here,” she said.

However, behind the scenes and despite the public pronouncements, in other respects it was business as usual. Pepsi and the Aberdeen-based firm Saltire Seed had a deal to send seed potatoes to Russia for the snacks market and although some people in the trade were deeply worried about it – one trader told me it was a moral disgrace – Pepsi was originally insisting the deal would be going ahead. The Scottish Government also said in private that it would facilitate the contract by providing all the necessary labels and certification.

When I first discovered what was going on here, the defence that Pepsi gave me was pretty firm. Their Scottish farmers, they said, had spent four years nurturing the seed potatoes and there were also 40,000 agricultural workers in the Russian supply chain that they wanted to continue to support. As for the Scottish Government, they effectively said it was nothing to do with them but they also told the traders that they would provide the necessary approvals for the contracts to go ahead.

When I wrote about the deal, the government stuck to its line (“nothing to do with us mate”) and I expected Pepsi would do the same, even if only just for financial reasons – the contract was worth more than £600,000. However, to their immense credit I think, Pepsi then phoned me and told me they’d talked to their Scottish farmers and had changed their position. The deal would not now go ahead, they said, and they would compensate the farmers and find another use for the potatoes.

I have to say: I’m impressed. From the start, Pepsi’s defence didn’t really hang together - as one trader put it to me: why would we avoid hurting Russian Pepsi workers when we’re prepared to hurt Russian energy workers by refusing to take their oil and gas? But Pepsi obviously went off and thought about it and weighed up the consequences of going ahead against the consequences of changing their mind and decided: we need to pull out.

No one is saying these kind of decisions are easy. I spoke to the director of the Institute for Business Ethics, Dr Ian Peters, about it, and he laid out the kind of balancing act companies like Pepsi have to negotiate. Pull out of Russia and it will cost you financially - through lost profits and compensation and so on. But stay in Russia and it could cost you in terms of your reputation, sales (if people start to boycott your products) or future business (if other firms decide not to deal with you). It’s commercially tricky either way.

However, Dr Peters’s advice to companies - and it could equally apply to governments - is that they should have a clear set of values that provide the ethical compass for them when making the kind of difficult decisions required when something like the Ukraine war happens. It will not always be clear what you should do – and there can be competing duties of care – but if you’ve taken the time to consider your values and produce a code, you may be better prepared to deal with difficult ethical decisions when you have to.

To be fair to Pepsi, what they tried to do originally was balance their competing duties - including the duty to their shareholders obviously. But ultimately they were faced with the big question: by continuing to operate in Russia, are you giving tacit approval to the Russian regime and – more importantly for them I suppose – are you seen to be giving tacit approval? It was also important for them to appear consistent, and cancelling sales of Pepsi Cola but not cancelling the Pepsi snacks business looked inconsistent.

As for the government, Dr Peters made the point that governments are critical to all of this. It’s important that companies behave ethically but all companies have to comply with government regulations - if the UK Government were to ban all exports, that would end the dilemma for Pepsi and other companies while of course opening up other problems such as the possibility of retaliatory sanctions by Russia. We have to be careful not to sanction ourselves.

The problem for the Scottish Government is that its behaviour was not consistent with what Dr Peters might call its code of conduct. In public, it was saying it would do everything it could to stop trade with Russia but in private it was telling the potato companies the decision was up to them and if they did decide to go ahead the government would give them the necessary approvals. It creates a gap between the government’s private actions and its public pronouncements and at least PepsiCo has now sought to close the gap in their case.

I realise, of course, that it’s all very well to call on others to be morally consistent and make sacrifices. I also realise that we’re talking about a lot of money here, although one trader told me they were prepared to lose money rather than send their potatoes to Russia. The point is that organisations, companies, and governments should act publicly and privately in a way that’s consistent with the values they espouse and for Pepsi and for the Scottish Government, the Russian potato deal failed that test.

Now, at least, Pepsi has changed its mind and all credit to them for doing it. As for the Scottish Government, it too was wrestling with a complicated situation, not least the fact that some of this stuff is reserved to the UK. But all we’re asking for here I think is consistency – don’t bang on in public about how horrified you are about Russia and Ukraine and in private approve or facilitate deals that give the tacit approval to the Russian regime.

I should probably end all of this with what a Ukrainian told me when we discussed this problem. Does Pepsi care more about profit, she said, than the children who’ve been killed or the millions whose lives have been shattered? It’s a killer question really but I hope that Pepsi has now demonstrated what the answer is. It’s easy to be cynical about big global companies. But Pepsi has finally emerged from this with a bit of credit. And now: we wait and see.

Our columns are a platform for writers to express their opinions. They do not necessarily represent the views of The Herald.