Field change through PHP Script

I want to change custom field length through PHP Script. How to write a PHP Script for that and Where I have to keep that Script in Sugar 8.0 localhost?

Parents Reply
  • I have written one script using PHP. If I execute that script, length value is only updating in the database. But not updating in the studio

    <?php

    if(!defined('sugarEntry'))

    define('sugarEntry', true);


    require_once ('include/entryPoint.php');
    require_once('data/BeanFactory.php');
    require_once('include/database/DBManager.php');
    require_once('include/utils.php');
    require_once('include/SugarQuery/SugarQuery.php');

    $GLOBALS['db'];
    $field_name = 'testing_c';
    $new_length = 20;
    $query = "ALTER TABLE accounts_cstm modify $field_name VARCHAR($new_length)";

    $result =$db->query($query);

    ?>

Children