@beenu I believe you maybe running into the same issue that was faced here. Please check the answer and example code to see if it works for you.
Hope this helps! If you are still facing issues please let me know and I will be happy to take a further look.
-------------------------------
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.