ContentTypeRef not working as expected, inheriting from System instead of mine - sharepoint-2010

I have a SP project with two features:
a first feature that defines some fields, a content type and a list definition
a second feature that defines a list instance of the first feature definition
in the second feature, I use the ContentTypeRef element to bind to the content type defined in the first feature. I saw in many blog post and forum thread that Fields are not correctly populated to the list, but it's not my issue (maybe it's related ?)
The instantiated list defines a content type, but instead of inheriting from my content type, it inherits the "System" content type.
Is this behavior correct ? how can I actually inherits my content type instead of system content type ?
thx in advance
[Edit] the simpliest workaround I found is to copy past the content type definition into the contenttypes element of my list schema... but it's still a copy/paste operation (as ugly as it can be)

Please make sure that your content type ID is valid, I never managed to bypass the item content type (0x01) which means that your content type will have an ID of 0x0100{A-GUID}.
Anyway, even if you defined properly your content type and this one is working as expected when you bind it to a custom list, you'll still need to re-declare it in your list schema with all its field reference and once again, copy most of the definition of your field (I had issue with less than ID, name, display name, type in this area)...
Eg with the last list I created :
<ContentTypes>
<ContentType ID="0x0100FDCCBFFB0FBF4D5C8E069F582412909602" Name="UniverseTranslation" Group="XYZ" Description="Universe Translation" Version="0">
<FieldRefs>
<FieldRef ID="{39BF387B-C20A-4D30-BD17-CB70E4609FA2}" Name="LookupUniverse" DisplayName="Universe" Required="TRUE" />
<FieldRef ID="{824F7063-6D09-48CD-B5BA-FE9B5EE36D6A}" Name="WCC_Language" DisplayName="Language" Required="TRUE" />
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Translation" Required="TRUE" />
<FieldRef ID="{EC8E4DB7-B715-430B-9B4A-F222F025EFAB}" Name="RichDescription" DisplayName="Description"/>
</FieldRefs>
</ContentType>
</ContentTypes>
<Fields>
<Field
ID="{39bf387b-c20a-4d30-bd17-cb70e4609fa2}"
Name="LookupUniverse"
DisplayName="Universe"
Type="Lookup"
ShowField="Title"
Required="TRUE"
EnforceUniqueValues="FALSE"
List="Lists/Universes">
</Field>
<Field
ID="{824F7063-6D09-48CD-B5BA-FE9B5EE36D6A}"
Name="WCC_Language"
DisplayName="Language"
Type="VariationLabelsFieldType"
Required="TRUE">
</Field>
<Field
ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
Name="Title"
DisplayName="Translation"
Type="Text"
Required="TRUE">
</Field>
<Field
ID="{EC8E4DB7-B715-430B-9B4A-F222F025EFAB}"
Name="RichDescription"
DisplayName="Rich Description"
Type="Note"
NumLines="4"
RichText="TRUE"
RichTextMode="Compatible"
AllowHyperlink="TRUE"
IsolateStyles="FALSE"
AppendOnly="FALSE"
Required="FALSE">
</Field>
</Fields>
If you can post your content type definition and part of your list schema, I'm pretty sure we'll be able to provide a more relevant help.
Kindly

It worked for me by adding the relative folder path for the content type's resource folder. It also worked for adding multiple references for content types to the list as follows:
<ContentTypes>
<ContentType ID="0x01006775E96C04A04F52AC1FCE50F0CB0901" Name="contentType1" Group="Test Content Types" Description="Test Content Type" Inherits="TRUE" Version="0">
<Folder TargetName="contentType1" />
</ContentType>
<ContentType ID="0x0100958BB07B626A494F9201B03E96948F3D" Name="contentType2" Group="Test Content Types" Description="Test Content Type" Inherits="TRUE" Version="0">
<Folder TargetName="contentType2" />
</ContentType>
</ContentTypes>

Related

Content migration of plone dexterity content types in plone 5

I have a dexterity content type defined as model in Employee.xml.
<model xmlns="http://namespaces.plone.org/supermodel/schema"
xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<schema>
<field name="fullname" type="zope.schema.TextLine">
<description />
<required>True</required>
<title>Firstname and Surname</title>
</field>
<field name="position" type="zope.schema.TextLine">
<description />
<required>True</required>
<title>Position</title>
</field>
</schema>
</model>
Very easy. The class is defined in content.py.
class Employee(Item):
"""Convenience subclass for ``Employee`` portal type
"""
There are some instances of Employee in my database.
Now I want to add a new feature to my content type.
class Employee(Item):
"""Convenience subclass for ``Employee`` portal type
"""
def Title(self):
return self.fullname
Now I can see the fullname of the employee in the folder_contents view. But it works only for instances added after the modification. The "old" content seems to need a migration.
My question: How?
The docs did not help. (https://docs.plone.org/develop/plone/persistency/migrations.html)
The older instances haven't been re-indexed, so everything based on the catalog (collections, navigation, search, folder content, etc.) cannot be aware of their new Title attribute.
Just reindex your portal_catalog and it will be fine.

How does one link to other defined entities using their id?

When writing XML files I will occasionally need to reference another entity, such as a group, a category, or an action.
How can I accomplish this?
There are two different methods to do this, and which one you use depends on where you are in the record:
in the type="xml" or type="html" portions (such as tree and form views)
everywhere else
Inside the type=["xml" | "html"] portions you need to use %-interpolation:
<button string="..." name="%(fnx_pd.action_add_cleaning_order)d" type="action" />
<field name="item_id" domain="[('categ_id','=',%(fnx_pd.pd_cleaning)d)]" />
The thing you are linking to needs to be inside a %()d or %()s construct: %(module.id_name)d.
If not inside an xml or html segment, then you can use the OpenERP-provided ref() function to get the id:
<field name="value" eval="'ir.actions.server,' + str(ref('action_release'))"/>
<field name="context" eval="{'default_pos_categ_id': ref('point_of_sale.categ_others')}"/>
In both of the above methods, OpenERP will look up the actual value associated with the id given and substitute it into the record.

Solr query search for multiple instances for single keyword

I'm stuck on this one issue. What i want to do is to query on a Multivalued and see if a value comes up at least try. For example the field must be "FREE","FREE" and not just "FREE" or "FREE","IN_USE".
Field
<field name="point_statusses" type="string" indexed="true" stored="true" multiValued="true" />
Type
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
SQL
GROUP_CONCAT(cp.status) as point_statusses
Clarification:
I have an object that has multiple plugs and those all have a status of FREE, IN_USE or ERROR. What i want to do is filter on ones that have two plugs with status FREE and I can't change the structure of the schema.xml. How do i query to for this?
Unfortunately, it cannot be done without applying any changes to schema, because solr.StrField does not preserve term frequency information.
Quote from schema.xml:
...
1.2: omitTermFreqAndPositions attribute introduced, true by default
except for text fields.
...
However, if you can apply some changes, then the following will work (tested on the Solr 4.5.1):
1) Make one of the following changes to schema:
Change field to text_general (or any solr.TextField field);
<field name="point_statusses" type="text_general" indexed="true" stored="true" multiValued="true" />
OR add omitTermFreqAndPositions="false" to point_statusses definition:
<field name="point_statusses" type="string" indexed="true" stored="true" multiValued="true" omitTermFreqAndPositions="false"/>
2) Filter by term frequency.
Examples:
Search documents having exactly 2 'FREE' point_statusses:
{!frange l=2 u=2}termfreq(point_statusses,'FREE')
Or from 2 to 3 'FREE' point_statusses:
{!frange l=2 u=3}termfreq(point_statusses,'FREE')
The final solr query may look like this:
http://localhost:8983/solr/stack20746538/select?q=*:*&fq={!frange l=2 u=3}termfreq(point_statusses,'FREE')

duplicated list fields in documnt's properties

I have one site columns which is added to an existing Content Type that has been deployed via a Feature.
In the Content Type, the columns appear fine, but when viewing or editing the properties of a document which its list used the content type, the columns appear twice. They appear identical and updating one of the instances updates both instances. Looking at the available fields using PowerShell on the List Item and on the Site Collection does not show any duplication - the same is true when viewing the Library Settings and viewing the columns. Despite this, the duplication still happens when viewing or editing properties.
here is my code:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- My Column (Field)-->
<Field ID="{996A0BA7-4B25-44F9-9AE6-FBE47EC123CE}" Group="RK Fields" Name="Kategori" DisplayName="Kategori" Type="Text"
Hidden="TRUE" Required="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Kategori"/>
<!-- My Content Type -->
<ContentType ID="0x01010053e1d612ba3f4e21aa250ecd751942b3"
Name="RKDokument"
Group="RK Content Types"
Description="Innehållstyp för dokument på RK"
Inherits="TRUE"
Version="0">
<FieldRefs>
<FieldRef ID="{996A0BA7-4B25-44F9-9AE6-FBE47EC123CE}" Name="Kategori" />
</FieldRefs>
</ContentType>
</Elements>

How to update a lookup field using a web service

I have a Nintex workflow and I am using a "Call Web Service" action to add a new list item in another site. I want to update a lookup field in the destination list from a lookup field in the source list. This is my CAML query
<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>Kaizen Blast Objectives</listName>
<updates>
<Batch OnError="Continue" ListVersion="1" ViewName="">
<Method ID="1" Cmd="New">
<Field Name="ID">New</Field>
<Field Name="Title">{ItemProperty:Title}</Field>
<Field Name="Event_x0020_Driver">{ItemProperty:Event_x0020_Driver}</Field>
<Field Name="Problem_x0020_Statement">{ItemProperty:Problem_x0020_Statement}</Field>
<Field Name="Group1">{ItemProperty:Group}</Field>
</Method>
</Batch>
</updates>
</UpdateListItems>
"Group1" is a lookup field in the destination list and "Group" ({ItemProperty:Group}) is a lookup field in the source list.
A simple assignment like I have doesn't seem to work.
EDIT
The lookup field in the destination list is a site column.
Any ideas?
I figured it out. When updating a lookup field the format has to be id;#value. This is true even if the source and the destination fields are of the same data type.