I am looking to find best way to convert properties into custom field autometically

Hi Guys,

I was building a extension which could convert custom fields to properties like execute a command and convert all custom fields into properties from given product ids.
But that is not working , any suggestion from you guys if this is possible.