Content Type Instantiation: Picking value of a reference field - sensenet

I'm trying sensenet features, my focus is on reference field inside content type.
I defined & installed the following content type successfully.
<?xml version="1.0" encoding="utf-8"?>
<ContentType name="EmployeeCT" parentType="GenericContent"handler="SenseNet.ContentRepository.GenericContent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>Employee Record</DisplayName>
<Description></Description>
<Icon>Content</Icon>
<AllowIncrementalNaming>true</AllowIncrementalNaming>
<AllowedChildTypes>EmployeeCT</AllowedChildTypes>
<Fields>
<Field name="Manager" type="Reference">
<DisplayName>Manager</DisplayName>
<Description></Description>
<Configuration>
<AllowMultiple>false</AllowMultiple>
<AllowedTypes>
<Type>EmployeeCT</Type>
</AllowedTypes>
<SelectionRoot>
<Path>/Root</Path>
</SelectionRoot>
<!--<DefaultValue>/Root/Path1,/Root/Path2</DefaultValue>-->
<ReadOnly>false</ReadOnly>
<Compulsory>false</Compulsory>
<VisibleBrowse>Show</VisibleBrowse>
<VisibleEdit>Show</VisibleEdit>
<VisibleNew>Show</VisibleNew>
</Configuration>
</Field>
</Fields>
</ContentType>
The problem is that I could not found & pick manager of employee.
Any help please,
Thanks.

Are there any previously saved content with the type EmployeeCT? Because you set it as the only allowed type as the value of the Manager field.
I've checked your code on my local site and it works. First I had to save an Employee Record to create a content for a manager and then I was able to pick it as a manager of a new Employee Record.

Related

XSLT - set a condition in template to execute only once for sub sequent nodes

I am new to XLST, posting my question after searching for help in this portal.
I have a typical scenario where I need to transform XML into target XML as blocks per status at record node level below.
But the Header <eventName> and <eventdate> should present only once in first block of section in my target file.
I’m using nested for loop on Header in that another loop on record to scan each status code. Once I find status code is !=’00’ then calling a template.
How do I check or set a condition with in template to execute only once for subsequent calls on template?
Tried with a param that var defined in top loop with value assigned position() but it did not work as record level it would remain same.
Please advise a solution.
An example input XML looks like below:
<?xml version="1.0" encoding="utf-8"?>
<n0:example>
<eventName>Managers Event</eventName>
<eventdate>09292016</eventdate>
<header>
<status>01</status>
<SubHead>
<Record>
<status>10</status>
<Service>Food</Service>
</Record>
<Record>
<status>00</status>
<Service>Music</Service>
</Record>
</SubHead>
</header>
<header>
<status>02</status>
<SubHead>
<Record>
<status>11</status>
<Service>Food</Service>
</Record>
<Record>
<status>00</status>
<Service>Music</Service>
</Record>
</SubHead>
</header>
</n0:example>

Mule ESB: Issue w/ XML generated from MapsToXML input to DataMapper

I have a JDBC outbound endpoint that after performing Map To XML transformation, gives out XML in the following format:
<?xml version="1.0" encoding="UTF-8"?>
<table>
<record>
<field name="DESTINATION" type="java.lang.String">SFO</field>
<field name="PRICE" type="java.lang.String">500</field>
<field name="ID" type="java.lang.Integer">2</field>
</record>
</table>
The problem is that when I try to generate the schema for this XML for use in the datamapper , the fields that are generated from this are not usable (it only shows field , In the mapping file I get this message when I try to hover over it :
'The attribute cannot be dragged since it does not belong to 'Current Element Mapping'
How do I use my XML so that I can map those fields to either another CSV, database or some other entity?
Why not trying to map (via DataMapper) Map object directly to CSV or anything you'd like ? If you need this intermediary XML format, you can also use DataMapper for the initial Map->XML mapping and configure the way you want it to look like (instead using MapsToXML).

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>

Document ID is not set in contenttype when saving from Office client

I have a problem that i've struggled with for a long time. This problem manifests itself in the test environment, but not in my dev environment.
I have a document library template. In a event handler I attach several content types (which all inherit from a base content type which in turn inherits from Document). The base content type has a custom document template, and event handlers defined in xmldocuments on the contenttype definition.
The Doc-ID feature is switched on in the site.
When uploading a file to the document library, the document is assigned a document ID as expected. When saving a file from Word however, the doc-ID is blank. Apparently the value is set on the item, because when changing the content type of the item afterwards, the doc-ID appears with a number indicating that it was assigned when the file was first saved. When setting the contenttype back to the original value, the Doc-ID remains displayed in the view.
To clarify: This is not the ID field of the Item content type, but the Doc-ID that is created by the doc-ID feature in SharePoint 2010.
Any ideas to why this value is not set when promoting values from Word?
It seems that the solution lied in the base Document content type in the site collection. When the document-id feature is activated, event handlers are added to the content type definition as xmldocuments. When a regular document library is created, the content type in the library inherits from this content type, and thus gets a copy of the event receivers.
My custom document library with custom content types did not inherit from the site collection document content type, but rather from the base document content type (0x0101), and did not get a copy of the event receivers.
Copying the xmldocuments into my base content type seems to do the trick.
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>Document ID Generator</Name>
<Synchronization>Synchronous</Synchronization>
<Type>10001</Type>
<SequenceNumber>1000</SequenceNumber>
<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
<Data>
</Data>
<Filter>
</Filter>
</Receiver>
<Receiver>
<Name>Document ID Generator</Name>
<Synchronization>Synchronous</Synchronization>
<Type>10002</Type>
<SequenceNumber>1001</SequenceNumber>
<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
<Data>
</Data>
<Filter>
</Filter>
</Receiver>
<Receiver>
<Name>Document ID Generator</Name>
<Synchronization>Synchronous</Synchronization>
<Type>10004</Type>
<SequenceNumber>1002</SequenceNumber>
<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
<Data>
</Data>
<Filter>
</Filter>
</Receiver>
<Receiver>
<Name>Document ID Generator</Name>
<Synchronization>Synchronous</Synchronization>
<Type>10006</Type>
<SequenceNumber>1003</SequenceNumber>
<Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
<Data>
</Data>
<Filter>
</Filter>
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>

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.