Genpact Cora Knowledge Center

Support

Create an Activity Template

You create an activity template by copying and editing the XML of an existing activity.

Procedure

  1. Create a folder for the activity template.
    C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\ActivityTemplates\Custom
  2. In this folder, create the necessary files.
    • TemplateInfo.config (defines the activity's properties)
    • Activity.xml.sqtemplate (defines the activity's structure)
  3. Create a new folder for diagram elements.
    C:\Program Files\PNMsoft\Shared Resources\Components\Workflows\DiagramElementTemplates\Custom
  4. Copy the XML of an existing activity to the TemplateInfo.config file, and edit as necessary.
    See the Code Sample 1 below.
  5. 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.
  6. From tblTemplateActivities, copy the activity's fldProperties and paste them in the Activity.xml.sqtemplate file.
  7. 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.
  8. Save the file.
  9. 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 the TemplateInfo.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.

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">&amp;lt;DynamicBindings xmlns="http://pmnsoft.com/sequence/2008/03/dynamic"&gt;&lt;TypeBinding&gt;&lt;Methods&gt;&lt;Method Signature=
"SP.Response Execute(SP.Request)" Direction="In"&amp;gt;&amp;lt;Parameters&amp;gt;&amp;lt;Parameter Name="request"&amp;gt;&amp;lt;TypeBinding Type="SP.Operations.UploadDocumentRequest" 
HasValue="true"&amp;gt;&amp;lt;Members&amp;gt;&amp;lt;Member Name="List"&amp;gt;&amp;lt;TypeBinding Type="SP.ListByTitleReference" HasValue="true"&amp;gt;&amp;lt;Members&amp;gt;&amp;lt;Member Name=
"Title"&amp;gt;&amp;lt;TypeBinding Value="&amp;amp;quot;Documents&amp;amp;quot;" /&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;/Members&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;Member Name=
"File"&amp;gt;&amp;lt;TypeBinding Type="SP.BinaryFileSource" HasValue="true"&amp;gt;&amp;lt;Members&amp;gt;&amp;lt;Member Name="Content"&amp;gt;&amp;lt;TypeBinding Value=
"Encoding.UTF8.GetBytes(&amp;amp;quot;test&amp;amp;quot;)"&amp;gt;&amp;lt;Items /&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;Member Name="FileName"&amp;gt;&amp;lt;TypeBinding Value=
"&amp;amp;quot;test&amp;amp;quot; + Guid.NewGuid().ToString()" /&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;/Members&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;Member Name=
"FieldValues"&amp;gt;&amp;lt;TypeBinding Length="1" HasValue="true"&amp;gt;&amp;lt;Items&amp;gt;&amp;lt;Item&amp;gt;&amp;lt;TypeBinding HasValue="true"&amp;gt;&amp;lt;Members&amp;gt;&amp;lt;Member Name=
"Name"&amp;gt;&amp;lt;TypeBinding Value="&amp;amp;quot;Title&amp;amp;quot;" /&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;Member Name="Value"&amp;gt;&amp;lt;TypeBinding Value="&amp;amp;quot;Test&amp;amp;quot;" /&amp;gt;&amp;lt;/Member&amp;gt;&amp;lt;/Members&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/Item&amp;gt;&amp;lt;/Items&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/
Member&amp;gt;&amp;lt;/Members&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/Parameter&amp;gt;&amp;lt;/Parameters&amp;gt;&amp;lt;/Method&amp;gt;&amp;lt;/Methods&amp;gt;&amp;lt;/TypeBinding&amp;gt;&amp;lt;/DynamicBindings&amp;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>