Create a custom content type to be used with CreateTaskWithContentType activity in SharePoint Workflow


Create a folder at C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES for e.g. MyCustomContentTask.

Now add three xml files over there

Name them as

· Feature.xml

· MyCustomContentType.xml

· MyCustomContentTypeColumns.xml

First define your custom content type as following (MyCustomContentType.xml)

Our custom content type would be including two custom columns i.e. one for FirstName and other for LastName.

<?xml version=1.0 encoding=utf-8?>

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<ContentType ID=0x0108010011D80FDA18534a3f9A162A1F5D6187F0

Name=My Custom Content Type

Group=Custom Content Types

Description=Custom Content Type

Version=0

Hidden=FALSE>

<FieldRefs>

<FieldRef

ID={9A447D6C-5BB8-4890-80E5-056B60FF6462}

Name=_FirstName

/>

<FieldRef

ID={76CC8E55-59C9-40d6-B46B-A4C1D95B16CB}

Name=_LastName

/>

</FieldRefs>

<XmlDocuments>

<XmlDocument NamespaceURI=http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url>

<FormUrls xmlns=http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url>

<New></New>

<Display></Display>

<Edit></Edit>

</FormUrls>

</XmlDocument>

</XmlDocuments>

</ContentType>

</Elements>

ID- Id of the custom content type

0x0108010011D80FDA18534a3f9A162A1F5D6187F0

0x010801 –The id of the base content type the custom content type should derive from

http://msdn.microsoft.com/en-us/library/ms452896.aspx

Followed by 00.

And a new guid 11D80FDA18534a3f9A162A1F5D6187F0.

Name- Name of the custom content type.

Hidden – Whether or not the users should see the content type.

FieldRefs – Collection of column references. Can contain one or more FieldRef.

FieldRef- Define the fields.

Id – Give a new guid.

Name – Name of the field

XmlDocument – Here we could define our custom form that should open when users creates, edit  task or when the task is displayed.We can simply let it blank if we want to use the same forms that SharePoint uses for the default task.

Now to define the columns that we have just added we’ll put the following information in our MyCustomContentTypeColumns.xml file

For your custom columns (MyCustomContentTypeColumns.xml)

<?xml version=1.0 encoding=utf-8?>

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<Field ID={9A447D6C-5BB8-4890-80E5-056B60FF6462}

Name=_ FirstName

DisplayName=First Name

Group=Custom Columns

Type=Note

NumLines=10

Required= TRUE>

</Field>

<Field ID={76CC8E55-59C9-40d6-B46B-A4C1D95B16CB}

Name=_ LastName

DisplayName= Last Name

Group=Custom Columns

Type= Note

NumLines=10

Required=TRUE>

</Field>

</Elements>

Here we have two field tags corresponding to the FieldRef field defined in MyCustomContentType.xml.

ID- It should the same as defined for Field Ref field

Name- Same as defined for Field Ref field.

Type – Note i.e. appear as multiline text box.

Required – To make the field mandatory.

For more info for Field

http://msdn.microsoft.com/en-us/library/ms437580.aspx

And for the Feature.xml

Id – Generate a new guid for the feature

Title – The name for the feature

ElementManifest- Defining the location of the above two files defining our custom content type.

<?xml version=1.0 encoding=utf-8?>

<Feature Id=64CB36F5-BF1A-470e-A27F-213A9F170DA4

Title=My Custom Feature

Description=Represents a custom content type

Version=12.0.0.0

Scope=Site

xmlns=http://schemas.microsoft.com/sharepoint/>

<ElementManifests>

<ElementManifest Location= MyCustomContentTypeColumns.xml />

<ElementManifest Location= MyCustomContentType.xml />

</ElementManifests>

<Properties>

<Property Key=Globallyavailable Value=TRUE />

</Properties>

</Feature>

Now install the feature and activate it using the stsadm tool

stsadm.exe -o installfeature -filename MyCustomContentTask Feature.xml

stsadm -o activatefeature -filename MyCustomContentTask Feature.xml -URL http://localhost:82

Now to use it

Go to your Lists à Settings àListSettings

Scroll down to find Add from existing site content types

Click on it and Select your new content type from Available Site Content Types.

That’s it..


Discover more from Nishant Rana's Weblog

Subscribe to get the latest posts sent to your email.

Unknown's avatar

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

6 thoughts on “Create a custom content type to be used with CreateTaskWithContentType activity in SharePoint Workflow”

  1. Now to use it

    Go to your Lists à Settings àListSettings

    Scroll down to find Add from existing site content types

    Click on it and Select your new content type from Available Site Content Types.

    That’s it..

    Like

  2. hi
    thnx for the valuable info. but can you plz tell me when i click on the assigned to column /title on the wrkstng.aspx file[ title column which has a link to the custom task form[ approval/rejection form]/…
    i want to navigate to the same form. so for this , i can create a aspx form–application form from the vs 2010 proj. template. but, what r the lines i need 2 add on the aspx form designer file? what r the code i need to add in order to get the list id and the list item records.
    plz help.

    Like

Please share your thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Nishant Rana's Weblog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Power Platform Puzzles

D365 CRM, Power Platform Tips &Tricks

Power Spark

Power Spark By Shrangarika

Van Carl Nguyen

Exploration of Power Platform

My Trial

It is my experience timeline.

Power⚡Thomas

Sharing my knowledge and experience about the Microsoft Power Platform.

Arpit Power Guide

a guide to powering up community

Welcome to the Blog of Paul Andrew

Sponsored by Cloud Formations Ltd

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Microsoft Business Applications Ninja!

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog - PPUG.ORG

AI - Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue

The Professional Paraphraser

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

Power Platform Learning

Your Go-To Resource for Power Apps, Power Automate & More

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.