why not just create a java action with this code.I think you have for everything sorted here.
https://docs.mendix.com/refguide/java-actions/
Hope it helps!
You can do this with a single microflow activity:
Hi Shubham,
creating a java action as Rishabh suggested is probably the quickest option. Otherwise you can do this as followed: