I am looking for a way to change the names of the items in a custom field I created in studio, without changing their display labels.
I used the field editor (still in studio) to change the associations between names and labels, but despite my modifications, I am still getting the former names (those that were defined before my modifications) when I'm using the API.
How can I make the new names be effective?
Thank you for your help.
When you change the keys in a dropdown list (you called them 'names'), it will change the language file in SugarCRM, but will not change the existing values in your database. So a query to existing records that used the old keys will still return those old key values.
You will need to perform UPDATE queries in your database similar to:
UPDATE contacts_cstm SET mydropdownvalue_c='NewValue' where mydropdownvalue_c = 'OldValue';
Related
I Want to change field length through a PHP script and Sugar beans in both database and Sugar CRM studio
You're question is very vage and doesn't show us what you've already tried, but I'll give it a go regardless:
Custom fields
Studio saves custom fields in DynamicFields beans, which are saved in database in the fields_meta_data table. The field's id is module name + field name, e.g. Accountstests_c for field test_c.
One way to change it is by updating the len column in the table and then run a Quick Repair & Rebuild (see notes below).
Alternatively you could adjust the field using the DynamicFields beans or using the ModuleBuilder's PHP controller similar to how Studio does it (I'll try to add an examples later).
Stock fields
You can adjust a field's length using Vardefs-Extensions.
E.g. if you want to change length (vardef attribute len) of the varchar-field name in module Accounts to 100:
./custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_name.php:
<?php
$dictionary['Account']['fields']['name']['len'] = 100;
Notes
Run a Quick Repair & Rebuild and your change will be applied in Sugar and Studio. Then scroll down and run the suggested DB changes.
If you want to do this without user interaction find or write a sugarcrm repair script.
When creating new Vardef extensions make sure to use the BeanName for the dictionary array index, so Account for Accounts or aCase for Cases. If unsure what to use, just see how existing vardefs files of the module in question do it.
For available vardefs attribute names and more insight into vardefs see here or look at the vardefs.php files in the modules/ subfolders.
With a few solutions Ive worked with I've created temp table's or history tables. Normally I script it to take a handful of fields needed from a main table and copy it over to the other table by
Setting a variable then setting field to the variable for each field in the new table / new record.
I have a situation now, where Im building a history table that needs to copy the current record as is. A snapshot where all fields from that instance of the record are copied to the history table.
Rather then setting a variable then set field to the variable, Id like to get some input on a quicker way to get this done where I can do this on a record level and not type out field by field to get it done. Also if fields are added to both tables then I have to make sure my script gets updated.
Ill keep hunting around.. appreciate any help.
-Rich
Do you have a sample of copying a record from 1 table to another
including all fields and setting some fields?
As I suggested in comments, use the Import Records[] script step, and select the same file as the source. If you choose Arrange by: [ matching names ] in the Import Field Mapping dialog, it will automatically map all source fields to their similarly named counterparts.
Note that you must establish a found set in the source table before importing.
For "setting some fields", you can define auto-enter options and activate them during the import, or run Replace Field Contents[] immediately after the import.
I'm using Filemaker Pro 12 and I was wondering if there is a way of creating a template for tables. There are a number of fields I'm placing in my tables that are identical utility-fields like modification time-stamp, active/inactive flags, etc. I was hoping there was a way that I could define the skeleton of each table somehow instead of having to manually add these identical fields every time.
If you are using the Advanced version, you can copy&paste fields among tables/files.
Using the regular version, you can import records from your "default" table and specify [New Table...] as the target table. This will recreate the source table's structure in the target file. The source table does not have to contain any records for this to work.
To expand a little bit on michael-hor257k's answer, if you're using FileMaker Pro Advanced, a good practice is to create a "Default" table that has your core utility fields. When you want to make a new table in Manage Database, instead:
Highlight the Default table,
Copy & Paste the table, then
Rename the new table.
I had some trouble previously when I wanted to take an existing visualization in tableau, and re-use it for a very similar data-set, but one where the field names are different.
In one case, as a workaround, I just renamed the new fields to the original field names even if the name didn't really apply. this allowed me to use the same chart I like. However, I wondered if there was a clean way to import a new data source and map the fields in the chart to the new field "titles" and preserve the chart?
I'm relatively new to tableau, so I'm sorry if this has been answered previously (I imagine it has somewhere). thanks
Right click on a field in the data view pane and select "replace references"
This is essentially a replace-all feature. Usually, you would do this when a field in the data source no longer exists by the original name (and is shown with a red X). Rather than recreating all your views, if there is a new field that you can use instead, you can replace all references to the old field with the new one in one command.
You could also use custom SQL to specify field names, define a database view or rename fields as you suggest
I am trying to store metadata (basically a unique id) along with each cell of a table in a Word document. Currently, for the add-in I'm developing, I am querying the database, and building a table inside the Word document using the data that is retrieved.
I want to be able to save any of the user's edits to the document, and persist it back to the database. My initial thought was to store a unique id along with each cell in the table so that I would be able to tell which records to update. I would also like to store some sort of "isChanged" flag within each cell so that I could tell which cells were changed. I found that I could add the needed information into the "ID" property of the cell - however, that information was not retained if the user saved the document, closed it, and re-opened it. I then tried storing the data by adding a data to the "Fields" collection - but that did not work and threw a runtime error. Here is the code that I tried:
object t1 = Word.WdFieldType.wdFieldEmpty;
object val = "myValue: " + counter;
object preserveFormatting = true;
tbl.Cell(i, j).Range.Fields.Add(tbl.Cell(i, j).Range, ref t1, ref val, ref preserveFormatting);
This compiles fine, but throws this runtime error "This command is not available".
So, is this possible at all? Or am I headed in the wrong direction?
Thanks in advance.
Wound up using "ContentControls" to store the information I needed. I used the "Title" field to store the unique id, and the "tag" field to track whether the field had been changed or not. See this link for more info: http://blogs.technet.com/gray_knowlton/archive/2010/01/15/associating-data-with-content-controls.aspx
Since a "Word 2007 Document" is XML, you can add a namespace to the document then adore the elements with attributes from your namespace. Word should ignore your namespace when loading and saving. Moreover, you can add new elments to store any information (metadata) needed.
With that said, I have not used this technique with Word, but I have done it successfully using Excel 2003.
First thing to try, is create a bare "Word 2007 Document". In your case, add a simple two by two table. Open it with a text or XML editor and add your namespace, and adore an attribute and add an element. Open with Word make a change then save it. Open with editor and make sure your namespace attribute and element have not been changed.