I think this link can help you to solve the problem: http://www.magnetismsolutions.co.nz/blog/paulnieuwelaar/2014/04/21/filter-n-n-add-existing-lookup-dynamics-crm-2013
The example is for N:N relationship, if you are working on
1:N subgrid, please change the method "Mscrm.GridRibbonActions.addExistingFromSubGridAssociated" to "Mscrm.GridRibbonActions.addExistingFromSubGridStandard"
Hope this helps anyone who stucks in such issue.
KalLuu/PhongChoi.