Standalone function get increment_id using order id
private static function getIncrementIDfromOrderID($orderID) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager $resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); $connection = $resource->getConnection(); $tableName = $resource->getTableName('sales_order'); //gives table name with prefix //Select Data from table $result = $connection->fetchAll("SELECT increment_id FROM " . $tableName . " WHERE entity_id = " . $orderID); if (count($result)) { return $result[0]['increment_id']; } return 0; }