Rule 327. Inconvenient forum. (a) When the court finds that in the interest of substantial justice the action should be heard in another forum, the court, on the motion of any party, may stay or dismiss the action in whole or in part on any conditions that may be just. The domicile or residence in this state of any party to the action shall not preclude the court from staying or dismissing the action.(b) Notwithstanding the provisions of subdivision (a) of this rule, the court shall not stay or dismiss any action on the ground of inconvenient forum, where the action arises out of or relates to a contract, agreement or undertaking to which section 5-1402 of the general obligations law applies, and the parties to the contract have agreed that the law of this state shall govern their rights or duties in whole or in part.