I have the following Fetchxml for a Custom report to get all the Active Leads:
<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">
<entity name="lead" >
<attribute name="companyname" />
<attribute name="leadid" />
<attribute name="gr_totaltraveldays" />
<attribute name="gr_marketvertical" />
<attribute name="leadsourcecode" />
<attribute name="lastname" />
<attribute name="firstname" />
<attribute name="estimatedamount" />
<attribute name="gr_dayssincelastactivity" />
<attribute name="new_numberofattendees" />
<attribute name="ownerid" />
<order descending="false" attribute="ownerid" />
<filter type="and" >
<condition attribute="statecode" value="0" operator="eq" />
</filter>
</entity>
I got this FetchXML from Advance Find in CRM 2011.
When i use this FetchXML in my report DataSet I get below error:
The gr_totaltraveldays field is there. I looked into the Database for fields and this field is in LeadExtensionBase table.
i had the same problem in BIDS with FetchXML.i was getting the error : "The attribute "XXXX" cannot be found for entity "XX". Specify a valid query, and try again." However, the field existed in the entity and was published.
The solution was to change the connection string, adding the organization name, in the Datasource as following: {URL};{organizationName};
then it worked!
for example : https://XXXX.crm4.dynamics.com;org12345ab;
You can find the organizationname in the Settings --> Customization --> Deveoper resources.
Regards!
Check your connection string. I had the same problem with my report.Seems like your connection string is explicitly pointing to the right organisation.
https://aaaa.crm4.dynamics.com;
This should work
Related
Not able to create tasks for new work order from Anywhere. Please suggest
Able to create a new work order without task
Added a new view for tasks, and trying to add taskId, status, Asset with lookup and Location with lookup.
lookup are not visible in UI. Here is my code
<view id="WorkExecution.NewAdhocWorkOrderInspTaskView" label="Create Inspection Tasks" >
<requiredResources id="WorkExecution.NewAdhocWorkOrderInspTaskView_requiredResources">
<requiredResource id="WorkExecutionAdhocINspTaskView.NewAdhocWorkOrderView_additionalasset" name="additionalasset"/>
</requiredResources>
<container id="WorkExecution.NewAdhocWorkOrderInspTaskView_workOrder_container_0" resource="AdhocWOInspTaskResource" >
<group id="WorkExecution.NewAdhocWorkOrderInspTaskView_group_0">
<groupitem id="WorkExecution.NewAdhocWorkOrderInspTaskView_workOrder_groupitem_4" >
<text editable="true" id="WorkExecution.NewAdhocWorkOrderView_groupitem_WorkExecution0.Asset" label="Asset2" layoutInsertAt="item1"
lookup="WorkExecutionAdhocWOInsptask" lookupAttribute="assetnum" placeHolder="Tap to enter1" resourceAttribute="InspTaskAssetNum" />
</groupitem>
</group>
</container>
</view>
<resource additionalData="true" id="AdhocWO_InsptaskResource" name="AdhocWOInspTaskResource" describedBy="http://jazz.net/ns/ism/asset/smarter_physical_infrastructure#WoActivity" providedBy="/oslc/sp/SmarterPhysicalInfrastructure" >
<attributes id="AdhocWO_InsptaskResource_attributes">
<attribute describedByProperty="spi:taskid" id="AdhocWO_InsptaskResource_spi_taskid" name="InspTaskId"/>
<attribute describedByProperty="spi:assetnum" id="AdhocWO_InsptaskResource_spi_AssetNum" name="InspTaskAssetNum"/>
<attribute describedByProperty="spi:location" id="AdhocWO_InsptaskResource_spi_Location" name="InspTaskLocation"/>
<attribute describedByProperty="spi:status" id="AdhocWO_InsptaskResource_spi_Status" name="InspTaskStatus"/>
</attributes>
</resource>
<resource additionalData="true" describedBy="http://open-services.net/ns/asset#Asset" id="additionalasset" name="additionalasset" pageSize="1000" providedBy="/oslc/sp/AssetManagement">
<attributes id="additionalasset_attributes">
<attribute describedByProperty="dcterms:identifier" id="additionalasset_assetuid_dctermsidentifier" name="assetuid"/>
<attribute describedByProperty="spi:assetid" id="additionalasset_assetid_spiassetid" name="assetid"/>
<attribute describedByProperty="spi:orgid" id="additionalasset_orgid_spiorgid" index="true" name="orgid"/>
<attribute describedByProperty="spi:siteid" id="additionalasset_siteid_spisiteid" index="true" isExactMatchIndex="true" name="siteid"/>
<attribute describedByProperty="oslc:shortTitle" id="additionalasset_assetnum_oslcshortTitle" index="true" name="assetnum"/>
</attributes>
<queryBases id="additionalasset_queryBases">
<queryBase id="additionalasset_queryBase_getadditionalasset" name="getadditionalasset" queryUri="/oslc/os/oslcasset"/>
</queryBases>
<whereClause id="additionalasset_whereClause"/>
</resource>
<lookup id="WorkExecutionAdhocWOInsptask" label="Select Asset" resource="additionalasset">
<requiredResources id="WorkExecutionAdhocWO_Insptask.AssetLookup_requiredResources">
<requiredResource id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset" name="additionalasset"/>
<requiredResource id="WorkExecutionAdhocWO_Insptask.AssetLookup_workOrder" name="AdhocWOInspTaskResource"/>
</requiredResources>
<list id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_list" resource="additionalasset">
<listItemTemplate id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_listItemTemplate_Item2Desc2" layout="Item2Desc2">
<listtext cssClass="bold textappearance-medium" id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_Item2Desc2_assetnum" layoutInsertAt="item1" resourceAttribute="assetnum"/>
<listtext cssClass="bold textappearance-medium" id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_Item2Desc2_description" layoutInsertAt="desc1" resourceAttribute="description"/>
<listtext id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_Item2Desc2_location" layoutInsertAt="item2" resourceAttribute="location"/>
<listtext id="WorkExecutionAdhocWO_Insptask.AssetLookup_additionalasset_Item2Desc2_locationdesc" layoutInsertAt="desc2" resourceAttribute="locationdesc"/>
</listItemTemplate>
</list>
<returnAttributes id="WorkExecutionAdhocWO_Insptask.AssetLookup_returnAttributes">
<returnAttribute id="WorkExecutionAdhocWO_Insptask.AssetLookup_assetnum_asset" sourceAttribute="assetnum" targetAttribute="InspTaskAssetNum" />
</returnAttributes>
</lookup>
I have created custom entity employee. Now I want to add listeners for this entity so that I can track add/edit/delete employee operations.
In Liferay for portal enitites like Blogs, Group, User etc we can add properties like
value.object.listener.com.liferay.portal.model.Group=com.smb.test.hook.listeners.GroupListener
in portal.properties via hook-plugin.
But for custom entity this approach does not seem to work.
Any help would be appreciated.
For custom entity, we need to add the listener property in service-ext.properties instead of the portal.properties file.
For my employee entity I have added following property in service-ext.properties file:
value.object.listener.com.smb.employee.model.Employee=com.smb.employee.hook.listeners.EmployeeListener
Note: We need to manually create service-ext.properties file in src folder besides the service.properties file. We could have updated service.properties but since it auto-generates our changes would be lost and hence service-ext.properties is the correct liferay approach.
Here is the location of the service-ext.properties file:
Here is my service.xml:
<service-builder package-path="com.smb.employee">
<author>Suyash</author>
<namespace>smb</namespace>
<entity name="Employee" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
</entity>
</entity>
</service-builder>
I'm trying to add a task to a queue programatically. I found this example code: http://msdn.microsoft.com/en-us/library/gg328106.aspx, but it simply creates the queues instead of using existing ones. Is there an easy way to find the id of a queue?
I figured it out. I found that one can use the Advanced Find tool to generate FetchXML. Using that I was able to query for my queue and then get the ID.
Here's what I ended up using:
string fetchXml = #"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='queue'>
<attribute name='name' />
<attribute name='emailaddress' />
<attribute name='queueid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='name' operator='eq' value='{0}' />
</filter>
</entity>
</fetch>";
EntityCollection result = service.RetrieveMultiple(new FetchExpression(String.format(fetchXml, queueName)));
var myQueue = (Queue)result.Entities[0];
Console.WriteLine(myQueye.Id);
Hi StackOverflow members!
I have developing custom list in Visual Studio (trough XML). I created list definition (with content type) and added list instance to it.
Here is schema.xml of my list:
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="Teams" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Teams" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentTypeRef ID="0x010089E3E6DB8C9B4B3FBB980447E313DE94" />
</ContentTypes>
<Fields>
<Field Type="User" Name="Employee" DisplayName="Employee" Required="TRUE" ID="{7B18E941-BAAD-453A-895C-39579AB5A9F1}" Group="Sample Group" />
<Field Type="Boolean" Name="Manager" DisplayName="Manager" ID="{9FC927CC-45EB-4E9E-8F25-18AAEDF7DCAF}" Group="Sample Group" />
</Fields>
<Views>
<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="Employee" />
<FieldRef Name="Manager" />
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
</ParameterBindings>
</View>
<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitle"></FieldRef>
<FieldRef Name="Employee" />
<FieldRef Name="Manager" />
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="ID"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
</ParameterBindings>
</View>
</Views>
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
and elements.xml with list template and content type:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
<ListTemplate
Name="TeamList"
Type="10000"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="410"
DisplayName="TeamList"
Description="My List Definition"
Image="/_layouts/images/itgen.png">
</ListTemplate>
<ContentType
ID="0x010089E3E6DB8C9B4B3FBB980447E313DE94"
Name="Team Member"
Group="Sample Group"
Description=""
Version="0">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Hidden="TRUE" />
<FieldRef ID="{7B18E941-BAAD-453A-895C-39579AB5A9F1}" />
<FieldRef ID="{9FC927CC-45EB-4E9E-8F25-18AAEDF7DCAF}" />
</FieldRefs>
</ContentType>
<Field Type="User" Name="Employee" DisplayName="Employee" Required="TRUE" ID="{7B18E941-BAAD-453A-895C-39579AB5A9F1}" Group="Sample Group" />
<Field Type="Boolean" Name="Manager" DisplayName="Manager" ID="{9FC927CC-45EB-4E9E-8F25-18AAEDF7DCAF}" Group="Sample Group" />
</Elements>
The question is: how to add sample data to this list? Especially to field of type "User"?
I tried to add this code in list instance element like this:
<ListInstance Title="TeamList"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/TeamList"
Description="TeamList">
<Data>
<Rows>
<Row>
<Field Name="Employee">CONTOSO\joses</Field>
<Field Name="Manager">true</Field>
</Row>
</Rows>
</Data>
but, error occures: Error occurred in deployment step 'Activate Features': At least one field type in not installed properly. Any help for makeing it work with dialog would be very appreciated.
A User field is a special type of Lookup field. As such, the text value is represented in the format of ID;#TextValue. And really, it is only the ID that is important. The Value is largely ignored. This can be a problem because while the username will always be the same, the ID that represents that user will change from site collection to site collection.
Your row XML should look something like this:
<Data>
<Rows>
<Row>
<Field Name="Employee">99;#CONTOSO\joses</Field>
<Field Name="Manager">true</Field>
</Row>
</Rows>
</Data>
You said that this is being deployed to an existing site, so you can browse to the User Information page for CONTOSO\joses. The ID will be in the URL's query string. But be aware that even if the feature works in this site, there is no guarantee that the feature will work in other site collections.
To avoid this problem, instead of seeding a list instance using XML, I will generally use a Feature Receiver to pre-populate lists with User fields. I prefer EnsureUser because it will add the user to the site if the user does not already exist.
This will also work:
<Field Name="Employee">-1;#CONTOSO\joses</Field>
In SharePoint 2013 using -1;# to fill a column of type User is less prone to error.
If you misspell or provide a nonexistent user:
<Field Name="Employee">-1;#domain\nonexistent account or misspelled</Field>
The record is NOT created.
Explicitly specifying the ID may result in assigning an existing group or user and could be lot harder to debug. Especially if you also provide a value for the ID column:
<Field Name="ID">1</Field>
<Field Name="Employee">1;#domain\nonexistent account or misspelled</Field>
Both Rich's and Jonathan's answers are correct, just wanted to clarify and couldn't comment due to low rep.
I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly