What is the easiest way to change a field with a whole plethora of dependencies?
In the ‘Company’ section when you add a new call, there a field called ‘Summary’ I want to either amend or replace this with a field that has a drop down menu, but when I looked in to it, that field has some 28 dependencies so if I create a new field, how do I ensure I have got this bit right?
Many thanks
Nick
Not sure there is a quick way to do this - especially when you consider that changes would have to be replicated in any other environment you have deployed to, I would suggest:
Make a new field.
Mark the old field as redundant, e.g. add (REDUNDANT) in front of the name.
Work your way through moving dependencies from the old field to the new. When the old field has no dependencies you know your work is complete.
When you import to any other environment the old field will still exist but will be totally unused.
If the original field was populated perform a data migration to populate the new field.
Related
I've struggled with this issue my entire Acumatica career. The customer asks for a custom field made for a base Acumatica page. They give me the data type of the field. I create said field. The customer decides to change the spec which in turn changes the type on the field. I change the field type in Data Access, but it doesn't work. I change the field type in every place I know to find it (Data Access Class, .XML, CustObjects), the field still contains the same properties! I delete the field completely, run a clean publish to make sure it gets wiped and recreate the field with the same name. Nope! Some how the old type still remains assigned to that field. I have even completely deleted the project, ran a clean publish, recreated the project with the same name, ran another clean while empty, recreated the DAC object with the same name, ran ANOTHER clean publish, and it STILL has the old control type despite not being set in the project XML or CustObjects table.
How do I change the field type of a Usr field created via the Data Access section of the Customization Project?
My current solution is I just append a 2 to the name, so it becomes UsrFieldName2, which I really don't want to keep doing because this will mess up reports and anything else directly linked to that data field.
I used some of the Hybris reserved Deployment code and then later changed to non-reserved deployment type codes. Do I need to Initialize the system in-order to reflect the changes with new deployment code or just an Update works. There are many items that deployment code has been changed. Why update doesn't work?
When you use a reserved code in your deployment table, you're likely to add the attributes of your object in an existing table. If you have attributes with the same name, it'll surely be a mess in the table (I don't know how hybris will choose the table type for example).
When you run an update with the good deployment code, it will create a new table which is just fine. The other table which has been used by two objects will still remain potentially broken because hybris won't delete any column.
That's why you should initialize your system to have a clean DB. The issue is that you'll lose all your data.
If you need to migrate data it will be probably quite hard because you must have to look on the broken table and distinguish between the attributes that should not be there and the others. So I hope for you that it's just a dev issue!
Actually i would suggest you to do initialize rather than update more likely that the update will not work for you in this case and probably you will get some error messages saying invalid pk xxxxxxxxxxxx because of unknown typecode yyyy.
As you may know the typeCode (deployment code) is an essential operator for the generation process of PKs in Hybris and thanks to it Hybris can ensure the uniquenessity of the PKs, so even if you change the old typeCode with a new one it's very likely that Hybris will still keep the old typeCode somewhere hence PKs already generated will never be consistent with the new typeCode.
So that's why you should never change the typecode of an item once given.
My suggestion is :
To make a backup of your existing data (you can export it from HMC,
you may take a look at alain.janinm's answer here).
Then initialize your System.
Then re-import the data again.
Note : that typecodes between 0 and 10000 are already reserved for hybris
particular items.
I have a field on one of my base page types which I need to update programmatically from an external data feed, so that it can be included in my Smart Search index.
The documents are versioned, but I want to update the published value of this field regardless of checkout state, and obviously avoid any sort of overwrite when documents are checked in.
The field will not appear on the editor form -- or ideally, would conditionally display for Global Admins.
It appears that using the API to update the document without doing a CheckOut fails silently. However if I do a Checkout/Update/CheckIn on a checkout-out page, the author will lose their work I assume?
Any way to handle this "versionless" field via the Kentico data model and API?
I don't think there is a way around updating checked out pages. You can update the page type table directly, but as you mentioned, it will be overwritten when they check in. You could update the version history I believe to make changes to the current data that is checked out, but again, I think that will be lost if the user cancels.
The only way I can think of to solve your issue is to create another table that maps the values you want to the page. Then you don't have to worry about the pages being checked out, you just need to grab the documentID or something. Since the value isn't displayed to the editor, you just have a field that does a lookup on this table.
The preferred and right way is using the API but as you stated, it causes problems if a user has something already checked out and working on it or it's in workflow and not published yet.
If the field you're updating is page type specific, there is one thing specifically I can think of and that's going directly to the database to the page type's database field and perform an update to that field.
Note: this is not recommended unless you know specifically what you're doing and have done full testing on it
The down side of going direct to the database is this will not update the current version since you're using check in/out and workflow. You will also need to update the checked out and current version which means you need to:
Go to the Document itself in the cms_documents table and get the document you are working with.
Then using the fields DocumentCheckedOutVersionHistoryID and DocumentPublishedVersionHistoryID' you can get the version history IDs of the document from theCMS_VersionHistory` table.
Then you can perform an update to the CMS_VersionHistory and your custom page type fields.
You will then need to look in the CMS_WorkflowHistory table and find out if that document is in workflow and in what step.
After you have that workflow history step, use the VersionHistoryID field to go back to the CMS_VersionHistory table and update that record with your data.
Again, not an elegant solution since you are using check in/out and workflow but after some trial and error and testing you should be able to figure it out.
UPDATE
You may also be able to add a custom table or some other linked database table which will allow you to create a global handler. The linked table would be where you perform your updates via API and other calls without versioning or workflow. Then when a user updates a specific page type you could do a check to see when the last time that linked table was updated and update the field(s) you need on update of that particular page (of course by node and document IDs).
Unfortunately you'll have to check it in and out with API. See examples here.
Also you might need to publish it in order to reflect changes on the live site.
Is it possible to add a custom field to modx_site_content? What I'm trying to accomplish, is to add a field t_id. I've already added this in the database. However, when I save it using: $object->save(); nothing is saved for that field, it just comes up as Null.
The version I'm using is: MODX Revolution 2.2.4-pl (June 14, 2012)
Actually - I've answered that question before. You want to create a separate table and schema.
modx evolution external database
however - it looks like you want to add a field so that you can call it as part of the page/template in modx? You may have to write a plugin to extract that data at the same time as the resource.
I know this is an old topic, but now the ClassExtender extra will create the additional table for you based on your schema, add the additional fields to the Create/Edit Resource panel with a plugin, and save those field values to the table in the DB when the Resource is saved in the Manager. This can save a lot of time and trouble.
If you can wait, a new version that works in MODX 3 should be released soon.
Is there some definition around the attributes that are returned from the Lists.GetListItems? I am able to view the attributes retuned just fine but I am wondering if they would ever change?
Here are some examples of what I am seeing... #ows_Author, #ows_FileDirRef, #ows_PermMask
I would like to build some classes around these values and my concern is that if they are not published somewhere Microsoft may up and change them or some setting in Sharepoint may.
It is possible that they change as sharepoint (major) version changes. Every change is possible then.
Don't think it would happen in minor version.
However they may also change depending on what list you query. But fields your mentioned and many other fields are basic fields that every list will contain.
If you want to view field data yourself (for example, what Type they are), download Sharepoint Manager - it's invaluable tool for a developer.
These are internal field names for default SharePoint fields. Unless you explicitly change them, they will remain the same.
Micheal Yeager's blog has a table which describes these fields and their data types:
http://blogs.msdn.com/michael_yeager/archive/2008/11/03/reference-list-for-internal-field-names.aspx