Results 1 to 7 of 7

Thread: Making place an empty string, not null

  1. #1
    routledge is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    London
    Posts
    98

    Unhappy Making place an empty string, not null

    Hey everyone

    I have got myself a teeny weeny problem. I have linked our version of SugarCRM to our main database with the use of MySQL views. It has been a nagging and long winded affair but we are nearly at roll out. I have however got a nasty error on screen when I do not enter data into certain fields. This is `table`.`field` cannot be null. The reason I get this is simple the field that sugar is pointing to is a not null field and requires data. So I need to tell sugar to place a <-blank-> value in this field instead of null.

    I know what you are thinking, simply change the field to allow null and move on with my life. This is the problem, I cannot, the reason for this is that the database is linked to by approx 7 x international websites as well as other applications and by doing this could damage the other applications and sites. So where do I insert code to make sugar produce a blank value for the database. I have been trying to place it in the vardefs for the various modules but with no success.

    Regards

    John

    I'm running debian OS, apache 2.2, MySQL 5 sugar 5.2 CE

  2. #2
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Making place an empty string, not null

    Better alter that particular table to allow null values.

  3. #3
    routledge is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    London
    Posts
    98

    Default Re: Making place an empty string, not null

    Thank you for the speedy reply. however like I mentioned their is no way that I can change the field in the database to null.

    Regards

    John

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Making place an empty string, not null

    Hi John

    Can you clarify some details?
    Which module, which field?
    Are you saving sugarcrm data into a table other than the sugar one?
    Let us know the scene you are working on.

    Kind regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    routledge is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    London
    Posts
    98

    Smile Re: Making place an empty string, not null

    Hi Andre

    Long time no speak , what I have done is make the table (accounts) that sugar draws data from into a view table of another base table in a separate database on the same machine. This base table has all the information we require in the sugar accounts table as I have aliased the names from the base table to reflect in the view.

    For example external_customer.customer_name = accounts.name

    Sugar then sees the accounts.name and reads the data.

    It is a thing of beauty we are able to update create all the tables we require with that one issue. the external_customer.customer_name field is a not null, so it has to have some kind of data in it. Where sugar accounts.name does not. Now for this field I can make it a required field, however in other fields the data is more sensitive and we cannot enter null, give them a default value (end user ease of use), or even enter a space for the default value as this makes the other techs very uncomfortable. I tried to enter an empty string i.e '' but this still does not stop sugar from trying to enter a null value.

    Hope this helps Andre

    Regards

    John

  6. #6
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Making place an empty string, not null

    Did you try using a logic_hook before_save for this purpose?

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  7. #7
    routledge is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    London
    Posts
    98

    Smile Re: Making place an empty string, not null

    No Andre, please give me an example of your thoughts?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. null value in db for fileupload?
    By esplgopal in forum Developer Help
    Replies: 0
    Last Post: 2009-02-16, 08:27 AM
  2. NULL fields showing in the view as "NULL"
    By Staple in forum Installation and Upgrade Help
    Replies: 2
    Last Post: 2008-01-15, 01:54 PM
  3. custom field won't allow empty string
    By sacramentojoe in forum Help
    Replies: 2
    Last Post: 2007-12-13, 08:35 PM
  4. Making empty rows disapear when fields are removed
    By marcan in forum General Discussion
    Replies: 2
    Last Post: 2007-10-09, 06:59 PM
  5. Replies: 1
    Last Post: 2007-02-22, 12:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •