Remove custom fields created via package installation

Hi,

    I've attached the manifest we use to install a package into sugar. It works fine and all hunky dory. But when we uninstall the package, it leaves all these custom fields in the tables. How do I remove them?

Kind Regards,
Madhav Shenoy

_manifest.php.zip
Parents
  • Hi Madhav Shenoy

    Use below code in post_uninstall.php . this will help you

        $fieldsByModule = array(
            'Campaigns' => array(
                'is_scheduled_c',
            ),
        );
    
    
        require_once('modules/DynamicFields/DynamicField.php');
    
    
        foreach ($fieldsByModule as $moduleName => $fields) {
            foreach($fields as $field){
                $dyField = new DynamicField();
                $dyField->bean = BeanFactory::getBean($moduleName);;
                $dyField->module = $moduleName;
                $dyField->deleteField($field);
            }
        }
    
    
    
    
    
    
    
Reply
  • Hi Madhav Shenoy

    Use below code in post_uninstall.php . this will help you

        $fieldsByModule = array(
            'Campaigns' => array(
                'is_scheduled_c',
            ),
        );
    
    
        require_once('modules/DynamicFields/DynamicField.php');
    
    
        foreach ($fieldsByModule as $moduleName => $fields) {
            foreach($fields as $field){
                $dyField = new DynamicField();
                $dyField->bean = BeanFactory::getBean($moduleName);;
                $dyField->module = $moduleName;
                $dyField->deleteField($field);
            }
        }
    
    
    
    
    
    
    
Children
No Data