This sounds like an escrow situation where the third party (or the escrow) receives their commission. This can't be automated and the 3 parties all have to agree on the rate.
You'd usually use a 2 of 3 scheme with each party having one key. Then the escrow and the sender sign the transaction to be sent out.
This is the easy way of doing it but as @NeuroticFish said the payment to escrow can not be enforced this way since the sender and receiver can also bypass the escrow and complete the transaction.
However, a more advanced way could be implemented to ensure the escrow receives his cut but it is not possible using Electrum. In this method you have to use the bitcoin smart contract capabilities through conditionals. The following script one of the ways to do it:
<escrow's pubkey> OP_CHECKSIG
OP_IF
<sender pubkey>
OP_ELSE
<receiver pubkey>
OP_ENDIF
OP_CHECKSIG
This way the escrow must always be one of the parties that signs the tx and only one of the other parties (sender OR receiver) has to be the other one signing the tx.
There is a problem with the above script which is if the escrow decided to not sign the tx, the other two can not do anything about it! We could make this script a little more complicated by adding a timelock which would remove this problem but the initial issue will rise again that the two parties could bypass the escrow after the locktime was reached.
OP_IF
<time> OP_CLV OP_DROP
OP_2 OP_1
OP_ELSE
OP_2 <escrow pubkey>
OP_ENDIF
<sender pubkey> <receiver pubkey> OP_3 OP_CHECKMULTISIGVERIFY
Note that this is non-standard because of OP_1 (invalid pubkey).
P.S. You can and should test these things on testnet.