Im trying to promote a previous version of an item programatically can someone tell me how can i do that?
Can you give the specific use case of this ? On which event you want to trigger this method ?
You can run below method to promote the item. (Ensure that, you elevate the logged in user based on the life cycle promotion role)
Item previousItem = innovator.newItem("Part","promoteItem");
previousItem.setID("ID of Previous Generation");
previousItem = previousItem.apply();