Date field default value must need to be Null in SugarCRM - sugarcrm

I am using Sugar Professinal 6.4.4.
The problem i am facing is this, that when i create a custom field of type Date (Not DateTime) and don't assign a default value to it. Then when i use that custom field in Edit and Detail View of a module and save the record without assigning any value to that field in Edit View, Sugar after saving the record automatically assign the current date to that field which gets visible in Detail View. Though in database the value for that custom field is still Null.
How can i stop this defualt behaviour of automatically assigning current value to that custom field?

If you want to save the default value as NULL, you can set the default value in fieldset as
['display_default']= "''";
If you want to save the current date, use this
['display_default']='now';

Related

Parse ClassFormDefinition for a Custom Page Type Field's Values

I want to populate a dropdown in my webpart from a custom page type field's values.
so for e.g I have a custom pagetype my.pagetype which has a field called myfield and has value like 1,2,3. How Do I get these 1,2,3 values ?
How do I access through SQL or macro so far I have reached till here and this code is giving me a long XML Schema string which has all fields definition and values of the custom page type.
CMSContext.Current.GlobalObjects.Classes["my.pagetype"].ClassFormDefinition
How do I get around?
Are you populating the drop down list in that Page Type manually? (e.g. 1, 2, 3)
If you want to reuse the same list of value in multiple places, it's better for you to create a custom table to store those value (e.g. customtable_myListX). Then for the drop down list, you can use the SQL option (SELECT Value, Display FROM customtable_myListX).

How to retain the value of an editable text field in a Lotus Notes form every time the user opens it?

I have a form in Lotus Notes containing an editable text field.
Once the user enters a value in that field, it gets saved properly when I check it by opening the document from the back-end.
But I need this value to be seen in the form every time the user opens the form.
Because it is a configuration form where the user should be able to see all the values saved.
For example, a field which contains the path to download a report. And it should be an editable field itself. Is there any way to do this? Any sort of clue or help would be really appreciated. Thanks in advance!
The value of an editable field stored in a document does keep it's value every time the user opens the document.
It sounds like you may ask for something else. You want User A to create a document, enter a value (i.g. a download path) and save the document. When User A or User B later creates another document based on the same form, the previously entered value should be the default. Is that what you mean?
In that case you could simply use #DbLookup or #DbColumn in the formula language in the Default Value property of the field.
Or create a lookup view with the previously created document, sorted descending by date, then use the GetFirstDocument method of the NotesView class to get the first document in that view and read the value out of it using the GetItemValues method of the NotesDocument class.
Performance tip: If you make sure the value you want to look up is visible in the lookup view you can use the GetFirstEntry method of the NotesView class, then use the ColumnValues property to get the value, this is much faster.
Solution is to use #DbColumn in the default value of the editable text field of my form

Invisible value when creating new record

I have problem with some form in Access 2010. In one of the fields (Amount) I have as a value expression =IIf([IsNull([Code]);1;2) . In the form the values 1 and 2 are shown correctly but when I try to save the newly created record I have an error: You have to fill the Amount field. Can someone tell me why the value is not visible when saving new record to database?
You need to use VBA code on the NewRecord and/or BeforeUpdate event to insert these values into this field/textbox. What you are doing here amounts to setting a value for Display only.

rails 3.2 check if hidden field has value while sending form

I have inside of a form one hidden field, which must be empty when the form is submitted.
Is any value in it, i want to set a flag in the database column.
How can i realize the check if the value of this hidden field is not filled?
Is it an issue for controllers or for models?
It is an issue for the controller. You want to check the value of that field in the create and update actions and store what ever you want to store there.

FormView tries to insert Null from Blank TextBoxes

I'm using a FormView control with the EntityFramework. I'm trying to add a new record, but every time I leave a text box blank, instead of inserting an empty string, it tries to insert a null.
How do I control this behavior so that it will use an empty string instead of a null?
you can handle this in the different levels of your application:
1) you can set default value in ItemCreated event handler and set default value there.
2) If you have permission to modify dblayer, you can set default value for column in db (or, maybe it is already set) and then set StoreGenerationPattern to Computed (look at, for example Entity Model - How to use Database's Default Column Values while inserting)