We establish a local martingale M associate with f(X,Y) under some restrictions on f, where Y is a process of bounded variation (on compact intervals) and either X is a jump diffusion (a special case being a Lévy process) or X is some general (càdlàg metric-space valued) Markov process. In the latter case, f is restricted to the form f(x,y)=∑k=1Kξk(x)ηk(y). This local martingale unifies both Dynkin's formula for Markov processes and the Lebesgue–Stieltjes integration (change of variable) formula for (right-continuous) functions of bounded variation. For the jump diffusion case, when further relatively easily verifiable conditions are assumed, then this local martingale becomes an L2-martingale. Convergence of the product of this Martingale with some deterministic function ( of time ) to 0 both in L2 and almost sure is also considered and sufficient conditions for functions for which this happens are identified.