create an appointment element (.ics) with nintex …...create an appointment element (.ics) with...

19
Page | 1 http://www.mcnext.com/ Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents INTRODUCTION ............................................................................................................................................................................................................. 1 Working environnement 2 Naming rules 2 CREATION OF AN APPOINTMENT ......................................................................................................................................................................... 2 Status 3 Start and end date of the appointment 3 Object 6 Localization 7 Description 8 Finalization 12 BONUS ........................................................................................................................................................................................................................... 13 Case #1: save the appointment in a file 13 Case #2: send the appointment in email like an attachment 15 INTRODUCTION During this "How-To" tutorial, we will create an appointment as a calendar type (.ics). Bonus: 1. Save the file in document library 2. Send the appointment in email like an attachment Note: if you would like details about the format of that kind of element, you could have more information with this link: https://en.wikipedia.org/wiki/ICalendar

Upload: others

Post on 25-May-2020

37 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 1

http://www.mcnext.com/

Create an appointment element (.ics)

with Nintex Workflow 2013

By François THOMAS, 02-25-2016

Contents INTRODUCTION ............................................................................................................................................................................................................. 1

Working environnement 2

Naming rules 2

CREATION OF AN APPOINTMENT ......................................................................................................................................................................... 2

Status 3

Start and end date of the appointment 3

Object 6

Localization 7

Description 8

Finalization 12

BONUS ........................................................................................................................................................................................................................... 13

Case #1: save the appointment in a file 13

Case #2: send the appointment in email like an attachment 15

INTRODUCTION During this "How-To" tutorial, we will create an appointment as a calendar type (.ics).

Bonus:

1. Save the file in document library

2. Send the appointment in email like an attachment

Note: if you would like details about the format of that kind of element, you could have more information with this link:

https://en.wikipedia.org/wiki/ICalendar

Page 2: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 2

http://www.mcnext.com/

Working environnement

- Software

o SharePoint 2013 On-Premise

o Nintex Workflow 2013 (3.1.7.0) – International

- SharePoint elements necessary for this "how to"

o A team site

o A calendar list in that team site

Naming rules

{ItemProperty:<reference to the column in the list, tab [Item Properties]>}

{WorkflowVariable:<reference to a variable creating in the workflow, tab [Workflow Variables]>}

{Common:<reference to a variable available in Nintex, tab [Common]>}

CREATION OF AN APPOINTMENT 1. First of all, execute a new session of your browser and go to the team site you have created and finally in the calendar

list (advantage of that list; all column necessary for this "how-to" already exists),

2. Starting from the SharePoint ribbon of the Calendar list, click on Workflow Settings > Create a workflow in Nintex

Workflow:

3. The workflow we will create is totally custom, so click on the workflow template Blank then on Create,

4. Before to start the design of the workflow, take few seconds to know what kind of elements are necessary in an

appointment.

Structure:

status (busy, free, tentative, out of office),

start date/time and end date/time of this appointment or if the event is during all the day, only a start and

end date (mandatory),

object (mandatory),

localization (facultative),

description (facultative).

Note: the status of our appointment will be voluntary fixed to "tentative" but it is totally possible to have a column

which can be used to make a choice between several statuses, directly in the list.

Page 3: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 3

http://www.mcnext.com/

Status

1. Place a Build String action in the designer and configure it like that:

Text: STATUS:TENTATIVE

Store result in: create a "Single line of text" variable named "txtFreeBusy" and associated it to this input.

2. Click on Save.

Result of the action

Start and end date of the appointment

1. The result of the start date/time and end date/time depending on if its duration is on the complete day or only in

few hours, a preliminary test is required. Consequently, add Set a condition action in the designer, and configure it

like that:

a) Condition : If current item field equals value

b) Where : All day event "equals" Value "Yes"

Page 4: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 4

http://www.mcnext.com/

2. Now that the kind of appointment is defined, we will see how is built the appointment period.

Go to the left branch ("No") and add the Build String action,

Keywords which represent a start date and an end date are "DTSTART" and "DTEND", and need to be in the

following format 'YearMonthDayTHourMinutesSecondsZ' (ISO 8601). The inline function "FormatDate"

available in the Nintex product ('fn-') allow that kind of conversion.

The 'Text' result will be:

DTSTART:fn-FormatDate({ItemProperty:EventDate},"yyyyMMddTHHmmssZ")

DTEND:fn-FormatDate({ItemProperty:EndDate},"yyyyMMddTHHmmssZ")

Store result in: create a "Multiple lines of text" variable named "textAllDayEvent" and associated it to this

input.

3. Go to the right branch ("Yes") and add the Calculate Date action.

We will see the option where the appointment is all day long, so the end of the appointment is finally the

next day of the input end date. It is necessary to add one day to the end date like that:

Page 5: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 5

http://www.mcnext.com/

Add the Build String action.

Format of the start and end date is 'YearMonthDay' only because it is not necessary to specified nor the

start or end time.

The 'Text' result is:

DTSTART;VALUE=DATE:fn-FormatDate({ItemProperty:EventDate},"yyyyMMdd")

DTEND;VALUE=DATE:fn-FormatDate({WorkflowVariable:dtEndDate},"yyyyMMdd")

Store result in: the variable "textAllDayEvent"

Page 6: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 6

http://www.mcnext.com/

Result of the action set

Object

1. Now, add the object of the appointment. To do that, add Build String action in the designer and configure it like this:

Text: SUMMARY;ENCODING=QUOTED-PRINTABLE:{ItemProperty:Title}

Store result in: create a "Multiple lines of text" variable named "textSummary" and associated it to this input.

Page 7: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 7

http://www.mcnext.com/

Result of the action

Localization

1. The following field is facultative. Add a Run If action in the designer to check if it is necessary to have more treatment

for this action.

Configuration will be:

Condition: If current item field equals value

Where: Location "is not empty"

2. Add a Build string action inside we will store the localization.

The localization is referenced by the "LOCATION" keyword and we will have the following result:

Text: LOCATION;ENCODING=QUOTED-PRINTABLE:{ItemProperty:Location}

Store result in: create a "Single line of text" variable named "textLocation" and associated it to this input.

Page 8: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 8

http://www.mcnext.com/

Result of the action set

Description

1. The next field is facultative too. So, add a Run If action to determine if it is necessary to do that action.

Configuration will be:

Condition: If current item field equals value

Where: Description "is not empty"

2. Building the content of that field is more complicated and require some additional treatment making it compatible

with the model.

First step, we need to get the description in the HTML format with the Query list action.

Configuration will be:

Editor mode: CAML editor, Current site

Add the following CAM query: <Query>

<Lists>

<List ID="{Common:ListID}" />

</Lists>

<ViewFields>

<FieldRef Name="Description" />

</ViewFields>

<Where>

<Eq>

<FieldRef Name="ID" />

<Value Type="Counter">{ItemProperty:ID}</Value>

</Eq>

</Where>

</Query>

XML encode inserted tokens: checked

Output option: Include HTML formatting in rich text columns

Page 9: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 9

http://www.mcnext.com/

Field: click on the "Insert reference" icon to select the Description column available in the "Items properties"

tab and click on Add. Create a "Collection" variable (keep the original HTML format) and named it "txt" to

store the result.

3. Now, get the stored value "txt" with the "Collection operation" action and configure it like this:

Target collection: txt

Operation: Pop

Store result: textDescription (create a new "Multiple lines of text" variable)

As requested in the Query List action, the content of the description is in the original column format, i.e.

HTML.

To be sure Outlook presents the content in right format, particularly the line feed and carriage return, it is

necessary to treat that information with regular expression.

4. First of all, we need to remove the closed DIV and BR tags to replace by the equivalent. Add the Regular expression

action and configure it like this:

Page 10: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 10

http://www.mcnext.com/

Pattern: (</div>)+|(<br\s*/>)+

Operation: Replace text

Replacement text: =0D=0A

Input text: {WorkflowVariable:textDescription}

Store result in: textDescription

5. Next, add a second Regular expression action to remove the opened DIV tag and configure it like this:

Pattern: (<div>)+

Operation: Replace text

Replacement text: let this field empty

Input text: {WorkflowVariable:textDescription}

Store result in: textDescription

6. At last, we are building the field which get the final format of the description. To do that, add the Build string action

in the designer and configure it like this:

The description field is represented by the "DESCRIPTION" keyword.

Text: DESCRIPTION;ENCODING=QUOTED-PRINTABLE:{WorkflowVariable:textDescription}

Store result in: "textDescription"

Page 11: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 11

http://www.mcnext.com/

Result of the action set

Page 12: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 12

http://www.mcnext.com/

Finalization

1. All element which represent an appointment are now completed and stored in multiple variables.

It is time to build the final content with the Build string action with the following parameters:

Text : BEGIN:VCALENDAR

VERSION:2.0

BEGIN:VEVENT

{WorkflowVariable:txtFreeBusy}

{WorkflowVariable:textAllDayEvent}

{WorkflowVariable:textSummary}

{WorkflowVariable:textLocation}

{WorkflowVariable:textDescription}

END:VEVENT

END:VCALENDAR

Store result in: create a "Multiple lines of text" variable named "textCalendar" and associated it to this final

input.

2. The creation of an Outlook appointment element is now ended. You do not have more than to decide on what you

want to make it of.

Result of the action

Page 13: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 13

http://www.mcnext.com/

BONUS 2 principals options are current manipulation of this element: save it as a file and/or send it as an email.

Case #1: save the appointment in a file

We will reuse the document library which is available by default in a team site: Shared documents.

To be sur to download simply the file, add a new column in the calendar list and named it UrlToIcs (URL format).

With the Nintex designer, it is not necessary to go directly in the list settings (save the workflow, closed the designer, etc.);

you can create it in the designer. In the Nintex ribbon, click on Workflow Settings and click on Associations Columns, New

Site Column to have this result:

This functionality allows you to create a new column in your list and add it as a site column.

To save the appointment as a file, we need a Web request action. Next, configure it like this:

URL: textFileUrl

Method: Other, PUT

Username & Password: user account with permission to write in the document library

Value: {WorkflowVariable:textCalendar}

Page 14: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 14

http://www.mcnext.com/

About the textFileUrl variable, we need to create it as "Single text" and configure it like this:

Text: {Common:WebUrl}/Shared%20Documents/{ItemProperty:Title}{ItemProperty:ID}.ics

Store result in: textFileUrl

We need to update the new UrlToIcs field with the Set field value action that we will configure like this:

Set: UrlToIcs

Equals: "Value" textFileUrl

Page 15: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 15

http://www.mcnext.com/

Et voilà, all action are now added to make an appointment and save it in a file. Publish you workflow and play with it. :-)

Result of the action set

Case #2: send the appointment in email like an attachment

If you would not save the appointment in a file, you can simply send it in an email as an attachment (it is possible to do both

of them, of course).

Add a Send notification action in the designer, and configure it like this:

To, Subject and Body: with your value

Attachments:

a) If you have generated a file and saved it in the document library:

i. Click on Add attachment, select Existing SharePoint Content option and insert the reference to the

"textFileUrl" variable and click on Save.

b) If you have only generated an appointment but not saved it:

i. Click on Add attachment, select New file and insert the "Title" reference with the '.ics' extension in

the Filename field and {WorkflowVariable:textCalendar} as Content ("Mime Type" need to be

"text/plain"). Click on Save.

Page 16: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 16

http://www.mcnext.com/

Action is configured like that:

Page 17: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 17

http://www.mcnext.com/

Result of the action

Send file

OR

Send content

All actions a now in place.

It is finally time to configure your workflow (Workflow settings) to specify the start option (add and update event for example),

publish it and see the result.

Page 18: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 18

http://www.mcnext.com/

The complete workflow

Page 19: Create an appointment element (.ics) with Nintex …...Create an appointment element (.ics) with Nintex Workflow 2013 By François THOMAS, 02-25-2016 Contents ... o Nintex Workflow

Page | 19

http://www.mcnext.com/