I'm triing to add a value to the custom field i made for a Group. (or site currently). I get a message thats is needs a int and not a string, how can i specify the type in the url?
localhost:8080/api/secure/jsonws/expandovalue/add-value?companyId=10153&className=com.liferay.portal.model.Group&tableName=CUSTOM_FIELDS&columnName=UID&classPK=24049&data=130
The exception i get:
{"exception":"com.liferay.portlet.expando.ValueDataException: Column 14911 has type custom.field.int and is not compatible with type custom.field.java.lang.String"}
The type of the custom field is a 32bit integer.
Any ideas?
Related
I had an attribute in an itemtype defined to be String. I changed the type of the attribute to Enumeration. However I am trying to update the existing values with an INSERT_UPDATE to one of the existing enum values and getting the following exception:
java.sql.SQLException: Fail to convert to internal representation
How to go about in this case?
The problem is the same as your previous question. (Redefining data type in items.xml in Hybris is not wise to change the type of an attribute. I would recommend to create a new field (with different name and use it for future) or just restore a previous copy of your DB.
I had this kind of error only when I don't update the system via HAC.
Update the running system!
hac > Platform > Update
System update won't change the dataType.
For Local: you can do an initialize with the new sample data.(for that particular Enum change).
For higher environments: You have to directly operate on the database. Alter the database column data first with the corresponding ENUM's PK value and then change the type of the database column to LONG
The context here is that we are building a simple standalone MVC-frontend to a Sharepoint Server installation (for political reasons) connecting by CSOM API.
We have defined some content types at site level which we use in different document libraries and lists on our site.
When you add a Content type to a document library or a list the Content type is copied to the doclib/list and gets a new guid.
The new guid is normally on the form
Parent Content Type ID + "00" + Hexadecimal GUID
We want
However, if you do a search then the returned document type is the actual Content Type defined at site level.
This means that we can't use the id from the resultrow to do a getContentTypeById().getName() in order to find the actual name of the content type of the result row.
Somehow I need to be able to find the parent (actual) content type of the result row based on the child contenttype with guid
Parent Content Type ID + "00" + Hexadecimal GUID
In other words how can I get:
Parent Content Type ID
from
Parent Content Type ID + "00" + Hexadecimal GUID
Parsing the content type ID to determine the name of a parent content type seems like an unnecessarily complicated approach.
If you're able to acquire a Content Type object from a list item in the Client Side Object Model, you can then retrieve its .Parent property to see its parent content type and any associated data.
I wound up modifying the source from a publically posted POC: http://datacogs.com/datablogs/archive/2007/08/26/641.aspx, which is a custom field definition for cascading drop downs. The modifications were to allow parent-child list boxes where a user can multiselect for filtering and selecting the values to be written back to a SharePoint list.
I got the parent-child cascading behavior working, but the save operation only takes the default Content Type value.
I changed the base type for the custom field control from "SPFieldText" to "SPFieldMultiChoice", along with changing the FLD_TYPES field definition values from: "Text" to "MultiChoice"
Steps Explained:
1. The custom field is created which is derived from ‘SPFieldMultiChoice’ class. The custom field allows multiple values to be selected.
2. The Field created using above custom field is added to custom content type created from GUI derived from ‘Document’ Content type.
3. The custom content type is added to the document library.
4. The document is uploaded and custom content type is selected and tagged to document.
A. The correct content type gets tagged with correct metadata if type of document is .xls,.doc,.txt etc
B. The default content type i.e. ‘Document Content Type’ gets tagged if type of document is .xlsx, .docx.
Issue Summary – Point#B: is an issue as correct content type is not tagged and default content type gets tagged if type of uploaded document is .xlsx or .docx.
However same content type , same custom field works if type of document is .xls or .doc.
Appreciate your inputs in this regard.
Thanks for taking the time to read through my post.
Cheers, ~Poonam
Not sure why this is happening, it might be a good idea to notify Microsoft of this behavior. The difference between .doc and .docx you describe is very, very strange. Could you try setting the content type in an itemeventreceiver, to force the ContentType or ContentTypeId field of the item to reflect the correct content type explicitly.
i.e.
item["ContentTypeId"] = new ContentTypeId("0x010100your_id_plus_the_part_added_by_list");
the_part_added_by_list is the extra guid that is added when a ctype is added to a list
this is because ctypes in a list are basically children of the actual ctype you added
i.e. 0x010100 YOURGUID 00 LIST SPECIFIC GUID,
you can get this full id using a tool like Stramit CAMLViewer, or progr. by looping through the SPLIst's ContentTypes collection.
(my guess would be to do this in the ItemUpdating / ItemUpdated event to see if there is a difference in ctype during those calls)
I'm building a custom search page and attempting to use an existing custom search scope. I'm having success using the SearchBoxEx with the AppQueryTerms = "ContentType:'my custom content type name'" but when i try using AppQueryTerms = "Scope:'My Custom Search Scope'" I get no errors, but also no proper results. I know my scope is populated using the advanced search so I must be using AppQuwryTerms wrong.
I've searched the net over and can't find the list of allowed AppQueryTerms filters. Is this Enum know to the stackerverse?
The problem is your scope name has spaces.
This worked for me:
AppQueryTerms="Scope:"My Scope""
The values for SearchBoxEx.AppQueryTerms are not an enum. They're actually a query written in a specific language for SharePoint Searching. The syntax for SharePoint 2010 is defined by microsoft on this page. It follows the format <Property Name><Property Operator><Property Value>
Scope is your property name.
: is your property operator for
matching using the property store database.
My Scope is your
property value.
The page above states:
The property restriction must not include white space between the property name, property operator, and the property value, or the property restriction will be treated as a free-text query. The length of a property restriction is limited to 2,048 characters.
Therefore, as in HelloSharePoint's example, you have to wrap the property value in quotes if it includes spaces.
Does your custom scope appear in the web sites list of Scopes?
http://intranet/[sitecollection]/_layouts/viewscopes.aspx?mode=site
Does the scope appear in a Display Group?
I have defined a custom list template type for SharePoint. I install it using VSeWSS 1.3 and everything seems to behave correctly.
I have added a custom action which will add additional columns (SPFields) to the list. However, every time that code executes it throws and ArgumentException with a 'Value not in the expected range.' error message. This behavior seems to be specific to custom types as suggested in this blog post.
Here is the relevant code (thisList is an instance of my custom list template type created using the browser interace) that tries to add a field to the SPFieldCollection of thisList:
SPFieldType fieldType = Format2SPFieldType(format);
SPField field = new SPField(thisList.Fields, fieldType.ToString(), fieldName);
thisList.Fields.Add(field);
The last statement (thisList.Fields.Add(field)) throws the following exception:
Message "Value does not fall within the expected range."
at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException)
at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName)
at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op)
at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXml(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op)
at Microsoft.SharePoint.SPFieldCollection.Add(SPField field)
This same code executes just fine if the SPList item is the base list type (built-in custom list).
Are there any fields that need to be set explicitly in the CAML and using the AddFieldAsXml() method directly to make this code work with custom list template types?
Update: I should also mention that the fields are actually created in some instances even though the call throws an exception!
Turns out that this was caused because calling thisList.SchemaXML put the SPList object into a state that I wasn't able to recover from! Getting a new reference to the same SharePoint List, e.g., SPList newList=thisList.ParentWeb.Lists[thisList.ID] solved the issue!
What is the Type of Field you are trying to add? is that an Internal field or a Custom Field type, what does this Function Format2SPFieldType return?
If it is a Inbuilt field can you try adding with the
thisList.Fields.Add("DisplayName", SPFieldType.Integer, false);