Is there a way to change a GL before posting a transactions in Dynamics 365?

Is there a way to change a GL before posting a transactions in Dynamics 365?
Hello,
All G/L Account posting is 'indirect' in Sales\Purchasing, so the G/L Accounts are pulled from the Customer Posting Groups, Gen Prod. Posting Groups, Inventory Posting Groups. You would have to make the necessary changes to the Posting Groups beforehand.
Thanks,
Chris