You create an activity template by copying and editing the XML of an existing activity.
Procedure
- Create a folder for the activity template.
C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\ActivityTemplates\Custom
- In this folder, create the necessary files.
TemplateInfo.config
(defines the activity's properties)Activity.xml.sqtemplate
(defines the activity's structure)
- Create a new folder for diagram elements.
C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\DiagramElementTemplates\Custom
- Copy the XML of an existing activity to the
TemplateInfo.config
file, and edit as necessary.
See the Code Sample 1 below. - To create a template activity based on an existing activity, add an activity to a workflow and define the activity properties according to your template requirements.
- From tblTemplateActivities, copy the activity's fldProperties and paste them in the Activity.xml.sqtemplate file.
- Edit the Activity.xml.sqtemplate file as necessary.
You might need to remove sections that you do not need in the file. See Code Sample 2 below. - Save the file.
- Perform IIS reset.
Result
The activity template is available in the App Studio Toolbox panel under the category you defined.
Important Notes
- The DiagramElementTermpateId element in the
TemplateInfo.config
file should be the same in both theTemplateInfo.config
files. - The template activity icon should be the same icon for both folders, but require specific file extensions.
- For the
C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\ActivityTemplates\Custom
folder, the icon should be a BMP file. - For the
C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\DiagramElementTemplates\Custom
folder, the icon should be a PNG file.
- For the
Code Sample 1
<?xml version="1.0" encoding="utf-8"?> <ActivityTemplate xmlns="http://schemas.pnmsoft.com/sequence/2013/07/templates/activities"> <TemplateData> <ID>02a2b10c-fab2-4c67-be53-6c76512677a4</ID> //Create a new Activity GUID using a GUID generator. <Name>UploadDocument</Name>//Define a name for the activity. <DisplayName>Upload Document</DisplayName>//Define how the activity name displays in App Studio. <Description>This activity enables you to upload a document.</Description>//Define the activity description as it appears in App Studio. <ActivityType>PNMsoft.Sequence.SharePointConnector.Activities.UploadDocumentActivity, PNMsoft.Sequence.SharePointConnector, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0a1a1b90c1c5dca1</ActivityType>//The activity type that you must take from the tblActivityTypes, and copy the fldType. <ContentTemplatePath>Activity.xml.sqtemplate</ContentTemplatePath>//The Activity XML file name. <Category>Misc</Category>//The category under which the activity appears in the App Studio Toolbox panel. You can define a new category. </TemplateData> </ActivityTemplate>
Code Sample 2
<?xml version="1.0" encoding="utf-8"?> //ADD THE FOLLOWING 5 LINES IF THEY DO NOT EXIST: <Properties xmlns="http://pnmsoft.com/sequence/2008/03/metadata" type="$activitytype$"> <Name type="System.String">$activityname$</Name> <Alias type="System.String">$activityname$</Alias> <Id type="System.Guid">$guid1$</Id> <Description type="System.String">$activitydescription$</Description> <DataSource type="PNMsoft.Sequence.Data.DbTableDataSourceDefinition, PNMsoft.Sequence, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0a1a1b90c1c5dca1"> <KeyFields type="System.String[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" length="1"> <Item>fldIActId</Item> </KeyFields> <SchemaName type="System.String">dbo</SchemaName> <TableName type="System.String">UACT$guid1$</TableName> <UseDefaultConnection type="System.Boolean">true</UseDefaultConnection> </DataSource> <Method type="PNMsoft.Sequence.Dynamic.MethodDefinition, PNMsoft.Sequence, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0a1a1b90c1c5dca1"> <Bindings type="System.String">&lt;DynamicBindings xmlns="http://pmnsoft.com/sequence/2008/03/dynamic"><TypeBinding><Methods><Method Signature= "SP.Response Execute(SP.Request)" Direction="In"&gt;&lt;Parameters&gt;&lt;Parameter Name="request"&gt;&lt;TypeBinding Type="SP.Operations.UploadDocumentRequest" HasValue="true"&gt;&lt;Members&gt;&lt;Member Name="List"&gt;&lt;TypeBinding Type="SP.ListByTitleReference" HasValue="true"&gt;&lt;Members&gt;&lt;Member Name= "Title"&gt;&lt;TypeBinding Value="&amp;quot;Documents&amp;quot;" /&gt;&lt;/Member&gt;&lt;/Members&gt;&lt;/TypeBinding&gt;&lt;/Member&gt;&lt;Member Name= "File"&gt;&lt;TypeBinding Type="SP.BinaryFileSource" HasValue="true"&gt;&lt;Members&gt;&lt;Member Name="Content"&gt;&lt;TypeBinding Value= "Encoding.UTF8.GetBytes(&amp;quot;test&amp;quot;)"&gt;&lt;Items /&gt;&lt;/TypeBinding&gt;&lt;/Member&gt;&lt;Member Name="FileName"&gt;&lt;TypeBinding Value= "&amp;quot;test&amp;quot; + Guid.NewGuid().ToString()" /&gt;&lt;/Member&gt;&lt;/Members&gt;&lt;/TypeBinding&gt;&lt;/Member&gt;&lt;Member Name= "FieldValues"&gt;&lt;TypeBinding Length="1" HasValue="true"&gt;&lt;Items&gt;&lt;Item&gt;&lt;TypeBinding HasValue="true"&gt;&lt;Members&gt;&lt;Member Name= "Name"&gt;&lt;TypeBinding Value="&amp;quot;Title&amp;quot;" /&gt;&lt;/Member&gt;&lt;Member Name="Value"&gt;&lt;TypeBinding Value="&amp;quot;Test&amp;quot;" /&gt;&lt;/Member&gt;&lt;/Members&gt;&lt;/TypeBinding&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/TypeBinding&gt;&lt;/ Member&gt;&lt;/Members&gt;&lt;/TypeBinding&gt;&lt;/Parameter&gt;&lt;/Parameters&gt;&lt;/Method&gt;&lt;/Methods&gt;&lt;/TypeBinding&gt;&lt;/DynamicBindings&gt; </Bindings> <CredentialType type="PNMsoft.Sequence.Security.CredentialType, PNMsoft.Sequence, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0a1a1b90c1c5dca1">Impersonated</CredentialType> <FactoryName type="System.String">Real Madrid</FactoryName> <IsOneWay type="System.Boolean">false</IsOneWay> <ParameterDirection type="PNMsoft.Sequence.Dynamic.ParameterDirection, PNMsoft.Sequence, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0a1a1b90c1c5dca1">In</ParameterDirection> <ProviderName type="System.String">SharePointDynamicProxyFactoryProvider</ProviderName> <ServiceName type="System.String">SP.ClientService</ServiceName> <Signature type="System.String">SP.Response Execute(SP.Request)</Signature> </Method> </Properties>