Random Tech Thoughts and my input on the Mobile Tech Debate
Framing the Conversation
First of all this is NOT a SharePoint specific blog, in fact its not about SharePoint at all, so if that is your expectation, stop now, read no further
With that out of the way, I have had face to face conversations, commented on blog posts, tweeted back and forth with at the very least Jeremy Thake @jthake , Joel Oleson @joeloleson, Andrew Connell @andrewconnell among others about them switching back to either and iOS or Samsung (Android) device, moving away from a Windows 8 Phone. Another disclosure, this is NOT necessarily adding to that specific line of conversation as much as it is another perspective on the topic. I am also making a few leaps here as well, most notable will be
- This assumes that you (the reader/folks I have spoken to) have BOTH a Phone AND a Tablet
- You are free [morally, ethically, physically]* to procure (buy it or get it provisioned to you) the devices aforementioned. *==if you need to distinguish between morals v/s ethics
- You accept this as an ‘academic’ dialogue and nothing else, I have seen some excitable & emotional exchanges on this topic.
A 10’000 Feet Look at me from a Technological Window
So, Ive heard this term used to describe folks similar to myself, “you live in a SharePoint bubble” when looking at our technological stance. Without agreeing or disagreeing with that definition, Id rather put forth another, one that I guess I can stand behind and defend. Id rather say that there is a Fabian bubble and within that bubble I have amongst my SharePoint bubble who is in there 100% of the way, various other technologies; some that I am kicking and screaming as I learn it, some I jump in at the deep end, some I am forgetting, some Im desperately trying not to forget.
However the fact of the matter is that I do work with the Microsoft Stack specifically with SharePoint, it hasnt always been that way, and likely that too will evolve, but for now this is where I am and its been that way for some time now. As a result, when you ask me a technological question, my first thought will revert to what I know and love as long as its an viable solution, and THEN, I will start to look outside box… as you were, bubble… The analogy I can compare that to is, imagine you are a farmer and someone ask you what produce would you recommend for them to eat with dinner tomorrow; I gather they will think about stuff THEY grow, but if it is not readily available to them, they will suggest other things that the individual can buy.. right?
Availability, Accessibility, and Ease of Use
So, just about everything else I am going to say will be tied back to this larger topic, but first I will do two things (1) I will disclose to you “HOW” these terms relate to me and what I have at my disposal, and (2) how I am defining the scope and usage of these words.
How they relate to me
- I have available to me an iPhone, iPad, WindowsPhone 8, XBox, Playstation and a few Laptops
- All my Microsoft devices have Windows 8 or the latest equivalent installed
- All my iDevices are NOT jailbroken, and have the most up to date IOS build on them
- my iPhone does not have Cell Service, its just connected to WIFI
- my iPad is not 3G/4G its WIFI only
Availability – Here is a public definition, mine is – the item is at hand, or inversely, the item “is not” out of reach, within reason
Accessibility – Here is a public definition, mine is – it builds on availability because although something may be available, it may not necessarily be reasonably accessible i.e. “the item is in my bag, but my bag is across the room”. So accessibility to me is the reasonable attainability of said item, “its in my pockets at all times”
Ease of Use – this one is a bit nebulous right? I can offer you both objective and subjective arguments to the same, but for the purposes of this discussion, lets go with – provides the same or similar functionality and features with the same amount of steps, and look and feel consistent.
Now my Thoughts
So without a doubt we are entering an age where everything is AppCentric and/or Mobile, I can find you studies showing that or you can take it from folks like Mike Watson @jmikewatson or Stacy Draper @stacyDraper here albeit with a little humor
But knowing that, OEM’s, ISV’s, Consultants, Engineers, and anyone who is dependent on Technology to make a living should make their products or services with that in mind. Ill go one further and this is totally MY opinion here… No one Product or Service will have the magic bullet,its NOT an ee-ther or i-ther decision. In that vein, I have made a decision on what I keep around to use. I want one of my items to be a iDevice, i want one to be a Windows 8 device, one day I will probably want to get an Android as well, but I dont want a proliferation of devices either.
Did I consider a Microsoft Surface?
Yes I did. When they announced the RT, I said “…nah, dont want it, I already have an iPad, Ill wait for the Pro”; why did i say that, well one reason was and again this is IMO, – the iPad is a “CONSUMER DEVICE” not a “PRODUCTIVITY DEVICE” and that is how I use it, the Surface Pro was marketed as a Productivity Device so in my mind, the RT is not one. So the question became, do I want to replace my iPad with a Surface RT as a consumer device, the answer was NO! a Clear NO infact, why
- My iPad is/or has
- it has more Apps – only a Volume distinction
- the apps are easier to use, be it more functionality or better in performance (battery life)
- at least to me its less in weight & when i hold it while laying down its easier to accommodate in my hands
- i already own it… no $$ leaving my pocket
- the Surface RT
- I would need to buy one.. try as I may.. I never seem to WIN one at any events I go to.. and I go to alot
- I would loose Apps that I KNOW I dont have on my Windows 8 Device, & I wasnt going to lug around a iPad AND a Surface RT just because of the availability [there is that word again] of Apps
- Its marketed as needing a keyboard (there are 2 of them, both more than I want to pay) which adds to the price point
- I would need to buy one.. try as I may.. I never seem to WIN one at any events I go to.. and I go to alot
So what about the Pro huh?
Well, back to who I am again and what I do; so I am a Developer by academics/profession, its what my degrees are in and what I get paid to do most of the time
So when I heard that you can install Visual Studio on the Pro, and you have Full Applications for Office etc, that peaked my interest…. but that was wayyyyyyy before i saw the Price OMG, are they nutz? Well when you, if you think like I do, start to say, well, I do like it, and so just how much time will I spend ‘cracking open Visual Studio’ on it, I had to say, hmmm I have a Laptop that has 24GB RAM, I use a few VM’s for my work, do i really need it? and again the answer was NO!
Would I take one IF it was GIVEN to me?
Well, Im not stupid… so Yes, would it have to be a Pro, again, probably Yes, because I see no benefit from getting a RT based on my above arguments. But I am developing Mobile Apps, so having the Form Factor available and accessible would be of benefit, plus there is the coolness and newness factor right? we are all humans here
So again Yes!
What about switching to an IOS or Android Device for your Phone?
Well, i NEVER thought about doing that. First, I like the concept/idea of having the phones capability LINKED to the PERSON rather than the Application. What do I mean by that? well on my WP8 device, if i want to send a tweet, email the person/group, all I need to do is locate said person/group and perform the application functionality I want to do [this goes back to Ease of Use and the App-Centric Society], now I am not saying other Phones don’t do that, but IMO not as well as Windows Phone 8 and I am also factoring in the Live Tiles Updates.
I also write (or Im attempting to do so) Apps for the Phone and since I am a Microsoft Dev, these are the languages i know, so need I say more?
Do I get tempted to switch because when I pull out my phone I want the same capabilities I have on my iPad — YES, but what I do is get some WIFI and do what I want, or I capture what I want (like a picture or video) and then use the App Later on a Device that support it for instance (1) I use Google+ to record videos for my Kids so they can watch it later on in life (as i saw on that Google commercial), so although inconvenient, I take my video on my WP8 phone, upload it to SkyDrive [which automatically Syncs to my Laptops, I have the App on my iPad] and then I use Google + on that device to persist and share my Pic or Video for my kiddos and anyone else.
Summary
I often will get into these conversations with folks I know, dont know, start responding to tweets when I see the topic crop up, so at least now I get to point y’all to this post. Now, understand that as time evolve and as I age and get more cynical, set in my ways, come into a boat load of money so that cost is not an issue, I reserve the right to change my mind:-)
I believe that I (and maybe you) are better suited if you get best of breed among an array of technologies however stay true to what you gravitate towards easily. For me, I love my phone for what it gives me from an accessibility stand point, I love what my iPad gives me from a availability standpoint, and i trade off for my Ease Of Use between both.
Addenda to Finally a SharePoint Designer every BA and Dev will Love
Alas, it was getting a bit busy on the blog post to cram so much Information so this Post follows on the 2 that were already done.
- Part 1 – Stages, Steps, Loops, and Visio Professional 2013
- Part 2 – Put it all together with HTTP Service Calls via REST and the Dictionary Object/ Variable
This post will look specifically at making those REST API Calls in SharePoint Designer 2013 (SPD2013) on Web Sites “other” than SharePoint i.e. those FREE API’s that are out there. This one will use the Free Weather Online API. You can get an account here and get a Key Just for you
So..What’s our Story
Well we will endeavor to create a Site Workflow that will run every 24 hours and 5 minutes and display using a Promoted List in SharePoint 2013 the Weather Forecast for the specific Office Location in our Fictitious company. Now, I’ve done a presentation at a SharePoint Saturday or two that discussed creating a Custom Action that would take a parameter (text box field) holding Zip Code so one could customize/personalize this Workflow.
We begin by creating a new Site Workflow
As all good post go, we tell you how to start, so Fire up your SharePoint Designer 2013 and connect to your SharePoint 2013 site, this can be On Prem or in Da Cloud. Click on Workflow then New Site Workflow
Next you Stub out your Workflow, this time you should know all of my bag of tricks now to make life easier so I am including as much as possible here below, if you don’t know or haven’t been following the series, take a look at the other two links in the top of this post.
I now do my magic for the HTTP Call, get the Sub-Set of Data I need and then Iterate through the values
Above is the Fiddler Call I use to inspect my results so I know what to put in my SPD2013 Get Item From Dictionary Action, once you have that bit of information, then the rest, you have seen be do before. So…
Basically we make our HTTP call, put it in our data Sub-Set, and Get each individual element inside our loop, the ONLY thing different in this example is that I am doing a Create List inside the loop to add the current record to my Promoted Link List and you will see that later on below.
Once you invoke the workflow it does its job and remains in a Paused state for 24 hours and 5 minutes then runs again. To the user they will see below if all goes well when they view the list or we can have it as a Web Part or App on a page
Summary
So there you go, you are now knighted as SPD2013 Workflow professionals, go thee forth and conquer!
So, my good buddy Chris @givenscj Givens, a really brilliant fellow said that doing this series in Visual Studio would be a benefit. I will take a few days to do that, but I promise I will, need to go back to billable work now
Part 2 of Finally a SharePoint Designer that Developer and BAs will Love
Purpose of this Blog Post & Primer for this Post
This post follows up on a previous post below where we discussed Workflows in SharePoint 2013 through the eyes of SharePoint Designer 2013 and Visio Professional 2013. Part 1 is linked below, this is Part 2
Part 1 – Stages, Steps, Loops, and Visio Professional 2013
In the above post (this one) I will go about showing you the tooling and various simplistic but apropos examples designed solely to drive the usage home, in Part 2 we will use everything in a practical REAL WORLD sense
Part 2 – Put it all together with HTTP Service Calls via REST and the Dictionary Object/ Variable
In this post I will take a Publicly Available REST API probably the Weather API or Twitter API and use the HTTP Web Request along with the Dictionary Variable in SPD 2013 to surface it in a SharePoint Promoted Links App (List)
What is the Dictionary Object/ Variable
Simply put a Dictionary Variable is an Array i.e. a collection of related items that is indexed/indexable but in more detail it is a container designed to hold a collection of other variables which can be of a different data types. Specifically we have the following actions out of Dictionary
- Build Dictionary
- Count Items in a Dictionary
- Get an Item from a Dictionary
Now before we get too deep into The Dictionary Variable/Object, lets take each of these actions one at a time in a simple scheme and see what they do exactly; kick the tires so to speak, in our real world example we will NOT be creating the Dictionary Object as much as consuming JSON data and dumping the JSON data inside a dictionary object. You get it right? JSON data usually comes across as a JSON Array or JSON object, in our case we want that JSON array, even if it is one item, the Dictionary Object/Variable EXPECTS to see an array, I actually wrote a blog post http://fabiangwilliams.wordpress.com/2012/12/31/limitations-when-using-sharepoint-2013-workflows-to-return-json-data/ explaining that issue, which i think is a BUG that should be handled by the SharePoint Team. But lets leave that on one side for the moment and get back into our intended post.
It is ALL explained Here
As mentioned earlier, a Dictionary Object may be considered a collection of related items. Now to drive this point home lets use what we have at our disposal, in fact we will use two (2) examples, the first of which is to simply build on what we did in Part 1 using the Bank of Fabian Example. You see, there are ALOT of post out there that do a good job of explaining to you how to get Weather Data, Twitter Data, ITunes Data, you know all the public REST JSON available stuff, and granted I will do one here as well in example number two in the spirit of being complete. However, what you don’t often see is showing how to use SharePoint own REST OData examples, so I will do one here. Lets set it up for you.
Our Use Case
Now I’m a big believer in Use/Business cases when doing Demos’ and not doing parlor tricks for the sake of “Hey! Look at this cool new stuff I can do”, so The idea here is that
1. You can consume data from ANY SharePoint List as long as you have an account that has permission or an App that does, and then act on or manipulate data from inside your Site Collection [assuming a Site Workflow here]
2. You want to expose data/information to an audience that doesn’t have access to certain data or hosted elsewhere
Web Site: http://adotob.sharepoint.com (this is my Office 365 Dev Site)
List Instance: https://adotob.sharepoint.com/_layouts/15/start.aspx#/Bank%20of%20Fabian
So from the above we can tell that we have a list called …/bank%20of%20fabian and it has currently 5 items inside it yes? Ok, good. Now in order for us to get to that data we can call on our SharePoint oData service located here
https://adotob.sharepoint.com/_api/web/lists/getbytitle(‘Bank%20of%20Fabian’)/items
Now you should understand that SharePoint 2013 REST APS doesn’t understand the $json options so, it will render its result in XML, however there are quite a few tools out there that can convert your XML to JSON. In fact if you adjust your request header on your call yourself in Fiddler or in browser extension such as Chrome or FireFox, you can get the visual effect you are looking for as well. So lets see what happens when you click on the link here for the REST API call
Now that is NOT going to be useful to us, so I will use this Chrome extension called ChangeHTTPRequest and after putting in my header i need which is
Accept: application/json;odata=verbose
I get the below
Now admittedly that is also difficult to read, so you should invest in the FREE JSON Viewer I always use and its Waaayyy cleaner, just cut and past the entire content and you can see what I mean.
So now that we have established some “Trust but Verify” credibility, next lets look at what we need to do in SharePoint Designer 2013 (SPD2013) to move this forward. We will be Demonstrating the following Capabilities in this Example
- How to use Dictionary Variable/Object
- We will build a Dictionary Variable to hold our HTTP Header information so we can get JSON Data
- We will Count Items in a Dictionary Variable so we can get the “Count” value of all items in there to assist us in our “Loop” that we may iterate through all the items in the Dictionary
- Get Items from the Dictionary that we may use to (as in our case) Write to the Log History so we can see what we are consuming, but in our Part 2 Example coming up using PUBLIC REST JSON data we will use that data to load into a ListItem
- Call a HTTP Web Service
- We will call that webservice we discussed above to get oData back
- We will discuss the other Dictionary Variables we will need in Support of this Call such as our ResponseContent and our subset of Data we want to inspect
- Do a Loop
- We will use the total items count that we got from our “Count Items in a Dictionary” Action as our loop counter max value in our Loop construct
Lets Build out our Workflow
The first thing we will do is create a Site Workflow
So in keeping with “Fabian’s Best Better Practice” we will stub out our Stages and Get some basic Logic out of the way
Once that is done the first thing we will do is build a Dictionary Variable to hold two items we need in order to get JSON data to be returned; we need to set the Accept and Content-Type HTTP header so the browser knows what we expect. We click Action then under Core Actions you will find Build Dictionary, because I use it a lot it is in my Recent Actions also
Once you click on ‘Build Dictionary’ you will get…
1 – You will then click on ‘this’ which will open up the dialog in [2] and in turn you will click the Add button. In doing so you will enter two Variables into this Dictionary Variable of String Data Type as aforementioned, in [3] I am showing you how i do it for the Accept header attribute.
When you are done, click the Ok Button. AND NOW YOU HAVE SEEN HOW TO CREATE A DICTIONARY VARIABLE and an acceptable use of it.
Next we will “Call the HTTP Service” by again clicking Actions in the Ribbon and then…
So again by clicking [1] ‘this’ we get the dialog box to enter the information about our HTTP REST Service which in this case we click on the ellipse [2] and put our workflow variable we created earlier that holds our URI, then we click [3] the OK Button.
Oh… i forgot something, but we can do that now… so you see in the above figure the second line has the (Output to Variable:dictionary) right? so I like to tidy up my Variable name, so what I do is click on the word ‘dictionary’[1] and create a NEW variable called RequestHeaders [2]
Now that that is done, we want to further configure the Service Request Call so we will ‘Right Click’ on our ‘Call’ and then Click on Properties..
Then I want to set the “RequestHeaders” Property to my Dictionary Variable “RequestHeaders”
and then click the OK Button.
Next we will need to ALSO create another Dictionary Variable to actually HOLD the data that’s coming back, if I haven’t said it before, that data comes back in the form of a JSON Array and the Dictionary Variable is the only object suitable to accept that data. So
and we name it ‘JSONResults’ so if we inspect the properties again you will see that we have everything we need now to call out to our HTTP Service and get meaningful results back
So now we can actually got GET the DATA now, by using yet another Action in the SPD2013 Ribbon, this time its the ‘Get Item from Dictionary’ Action
Once we do that we will want to click the ‘item by name or path’ link and give it the SUBSET or WHOLE path to the data we inspected in our JSON Viewer or whatever tooling you have to determine what you need. In our case we want the “d/results” subset then we will use the Index variable to get each line item. Furthermore we will want to store this information AS WELL into another Dictionary Variable.
So in [1] you have me setting the path based on what i want from evidence in the JSON Viewer, then in [2] I am showing you the relationship of use getting the values from the HTTP Call made earlier and finally [3] I’m dumping that data into another Dictionary Object.
if you forgot here is what i need to build that path take a look above at [1], then [2] to get my Array. In [3] I will use that below using the Index Variable inside a Loop Construct.
So that brings us to the last unique item we will be doing in our Dictionary Item and that is to get a COUNT of all the items in the Dictionary We Need. So again we go to the SPD2013 ribbon
and we now need to tell the action which Dictionary Item to count, REMEMBER we want the one that we did the Subset of, not the one returned from the Service Call.
Above [1] we are referencing our Subset Data and we are creating a new Variable of Integer type [2] to put that Number in. NOW this is an important distinction as well because what we have here is our UPPERBOUND number in the Array for out Loop Counter
smart huh LOL
Next we will enter the Stage “Loop and Write out our Data we Need” and put a Conditional Loop inside there that will use the Index value of 0 to start and STOP when we have reached the UPPERBOUND value of items in the array
Now when that’s all done, WE are done, one more Screen Shot and some guidance and you can take a mental break..
Now admittedly its a bit busy, and yes, its been hours now since I started on this blog and fatigue is setting in
but I think i can capture everything I need to say here, and I will wrap up as usual with a video. So we are setting the Initialize and Upper bound of our Loop counter in [1] and [2] respectively. In [3] we are actually going to WRITE OUT TO THE LOG the information garnered from the above two lines and the remainder is the Loop Counter which you saw in Part 1, so now time for the video of it all.
So this blog post is long enough, what I will do for the External Data Call is do it in another Post and I will Link to it here. Hope you learned something new.
Cheers
Up Next – Addendum to Part 2 showing an External HTTP Service Call using REST/JSON [Hyperlink forthcoming]
Finally a SharePoint Designer that Developers and BAs will Love
We hit the FiveFecta with Workflows
Our horse came in, that is SharePoint Designer has given us Five winning items in this iteration of the product, our five items are
- Stages
- Loops
- Steps
- Dictionary Object/Variable
- HTTP Service Calls
With all this you have the means to create atomic unit of work, conditional statements as well as the ability to make external calls to REST-full Service returning JSON data. The last piece of the puzzle is the addition of Visio Professional 2013 and the Stencils it brings to both author and report on the activities of the Workflow Activities.
Purpose of this Blog Post & Primer for this Post
This post well explore various usage scenarios of our Five Fecta through commentary, discussions and demo/screen shots. I am considering breaking this up into sections but perhaps it will just be one big post that covers a single solution, I’m still toying with the idea, either way its genesis is still fluid. If indeed i do break these up, I will put the various parts in this section.
Part 1 – Stages, Steps, Loops, and Visio Professional 2013
In the above post (this one) I will go about showing you the tooling and various simplistic but apropos examples designed solely to drive the usage home, in Part 2 we will use everything in a practical REAL WORLD sense
Part 2 – Put it all together with HTTP Service Calls via REST and the Dictionary Object/ Variable
In the above post I will take a Publicly Available REST API probably the Weather API or Twitter API and use the HTTP Web Request along with the Dictionary Variable in SPD 2013 to surface it in a SharePoint Promoted Links App (List)
What’s new with Workflows
Some things that you must know about Workflows in SharePoint 2013 is that unlike SharePoint 2010 that was built on the platform of Windows Workflow Foundations 3.0 (WWF3) this version of SharePoint is built on Windows Workflow Foundation 4.0 (WWF4) and .NET Framework 4.5, it also employs a new Installer/Manager called Workflow Manager 1.0. Now you have the ability to design and create complete declarative workflows, REST and Service Bus messaging. You should also be aware that the SharePoint 2013 features and capabilities only comes available to you and your tooling after you download and install the Workflow Manger 1.0 Service and configure it to communicate with your Site Collection. For more on the Workflow Manager 1.0 please see Start: Set up and configure SharePoint 2013 Workflow Manager Finally with Visio Professional 2013 add-in provides you with a Visual Workflow Development experience both inside SPD2013 and outside inside Visio Professional 2013.
<RANT>The one thing that I have as a gripe (but I totally understand why) is that Reusable Workflows are GONE in SharePoint 2013 Workflows </RANT>
But that is somewhat disingenuous because while you certainly cannot do it in SharePoint Designer 2013 if you create your workflow in Visual Studio 2013 and make a reference to the Workflow Manager 1.0 you can attach to the GUID of the Content Type.
This is what I mean, open up SPD2013 and fire up a Reusable Workflow and you will notice that you cannot bind a Content Type that you are used to doing in SPD2010 to this Workflow
but if you change the platform to SharePoint 2010 Workflow as seen below you can change the Content Type and make a selection to bind it accordingly.
But lets get back on track.
Stages – What is it, Why do we need it, What Problem does it Solve
Stages are new and introduced into SharePoint Designer 2013 (SPD2013), a stage can accommodate any number of shapes inside Visio and Action/Activities inside SPD2013. There has to be at least one (1) stage in every SharePoint 2013 Workflow and there can only be one path in and one path out of a stage, although while inside the stage they may branch. I will provide a demonstration of that below through a parallel process. You may NOT nest stages, if you want to have nesting capability, you should use a “Step” within a “Stage” in fact it is quite neater for others to follow even from a design standpoint. As you exit a stage, you select what other stage it will transition to, and within that transition step you may also employ conditional logic to determine what path it should take as it exits the current stage. Upon completion of a workflow you should set the transition to End Workflow. Below are some examples of what I just mentioned
Stub out your Stages as a Best Practice
Now as a Object Orientated Developer that is used to Modeling/Prototyping my Classes/Modules, it is just natural for me to see ‘Stages’ in that same fashion, I first consider the ‘Start’ OR ‘End’ of what i need to do and either work forwards or backwards thinking about all the pieces that will make the effort succeed, in the same vein, when I am building a SharePoint Designer 2013 Workflow I pause to consider what my Stages will be, and HOW I will transition between them, that way once I get that thought process out of the way, I am free to just put the logic I need inside my stages and my work becomes so much easier, or at the very least, I have a plan of action that anyone can follow. One more secret about doing it that way is that I can do a Visual Layout of my Stages and take that to a Business Analyst (BA) or Business Decision Maker (BDM) and validate what I am intending to build.
Step 1: Create a Workflow (in this example I am doing a List Workflow)
Once you fill out the necessary fields and click OK, you will be taken into the Active Workflow Design pane, and a Stage will already be present and waiting for your actions.
As denoted in callout 1, we have a default stage created for us, it is called “Stage 1”, but obviously you should change that to something more meaningful, in fact, the names of Stages are by default going to be the Status Messages that you see when your workflow is Running under the Status field in the Document Library or List, so you should think carefully about how you define and layout your stages as well as the nomenclature. This is yet another reason why I elect to stub out my Stages before anything else.
In callout 2, you will see the transition to stage area where you can direct the flow of the workflow, as previously mentioned but worth calling out here:
- there is one way into a stage and one way out
- you may directly tell the stage to progressively move to another stage, or use conditional statements to drive it dynamically or End the Workflow in that area
In callout 3, you will notice Stage is grayed out, but that is because at the point of me taking the screen shot, i was in the active stage and as i mentioned before you cannot NEST stages inside stages therefore the option to create another stage was not provided.
Once you have stubbed out your Stages as I have done below, you will have something similar to what is below, notice I am showing you what a Stage Transition looks like as well as showing you in the “Wrap Up” stage, that the workflow will terminate there.
If we check out our document library we will treat it as a Bank of sorts. We will use a Document Library because it represents a slip of paper that will authorize a transaction, a Credit or Debit, so for instance
We have a Metadata Column that will hold current balance after a Credit or Debit transaction is applied. Coming back to SPD2013 now we have to set up variables to hold these values in order to do our mathematical computations ergo
Looking at Basic and Conditional Stage Transition
Now that we have Variables in place and mind you, we could have just read from the Metadata columns, but I prefer to create variables so i have an assurance of the Data Type I need to use, we will now create some logic to demonstrate how we can transition through stages. I will not go into much detail here because the idea of this exercise is to demonstrate some of the ways you can transition through stages. In the first one we will just move to a different stage, whereas in the second, we will be checking for a condition
In the above figure “1” and “3” are basically logic to take some action or capture some variables from the Current Item, your focus here is Stage Transitions. Notice in “2” we are simply just calling the Stage we need to go to, In “4 ‘we are checking to see first (a) what type of transaction this is, if it is a Debit, then.. does the individual have enough money to do what he/she wants to do, it he/she doesn’t then go to the Stage “IF Crap Hits the Fan” otherwise, if the criteria is met or this is a Credit Transaction, go to “Process Calculation” Stage.
Looking at Internal Mechanics of Stages
So, lets take a look at what can happen inside Stages, for this example we will just look at Parallel Blocks and additional Conditional Logic
So what we have in the above is an example of a Branch in a Stage, we accomplish this by having a Parallel Block [1] and we have two steps inside that block [2] which will be run in parallel. You will see proof of that via the Visio Diagram and in the Workflow History Log, and you will notice that what is inside each Step runs in ‘Sequence’ [3]
Next we will look at how we “Process Calculation” and “Wrap Up” Stages
In the above illustration you will see that we are not doing anything special here that we haven’t done before, we are using conditional logic in both the stage and transition step to determine the path. you will also notice I make heavy use of the Log to History action, I do this to simplify my working area but these steps can be other stages or other actions, for me I am using it to convey messages to you about what is going on.
Below are some examples of what you would expect to see under differing scenarios
Scenario 1 – Add Money to The Account
We will look at the ‘You got Paid’ ledger under the Workflow History
Above you can see that in the log that the current balance was $30, but after crediting $100 it is $130 from the prior image showing the Document Library. Now lets look at a Debit.
Now lets take out more money that they can handle and see what happens in the video below pay attention to the last entry.
Summary on Stages
Hopefully the images and video demonstrates some of what is possible when using Stages in SharePoint Designer for SharePoint 2013 Workflows. If I didn’t already say it, its worth emphasizing that Stage Names become the Status Fields by default in your Library or List being acted upon, but you can also set your own Workflow Status Message.
A more meaningful Look at Steps
So, in the example of Bank of Fabian doing Debits and Credits, you saw “Steps” being used within a Parallel Block, but I want to build on that, and show how steps can really organize your Workflow. In this scenario lets take the approach of “Opening a Bank Account” so we will need to
- Run persons Credit
- Check Source of Initial Funding for Opening of Bank Account
- Run them through ChexSystems
- Verify them against Government Regulatory Checks
- Do a Approval Process for Opening of Account
- Open the Account if they Pass all the Above, Reject if they Don’t
Now off the bat, some of these steps can be done in Parallel; I would say steps 1 through 4 can be done all at once, then we do 5 and then 6, lets look at that
Stubbed out this is what it looks like
Now if we add just a little bit of logic in there it could potentially shape up to be like the below
What does Visio Professional 2013 Bring to the Table
So, thus far we have looked at:
- Stages
- Internal Mechanics
- Transitions
- Conditional Statements Within
- Branching
- Steps
- Overall Organization
- Loops
- Placement and Usage
Its ample time we look at how this effort looks like Visually in Visio Professional 2013, I cannot overstate how much this is important
to both TDMs, BDMs, and the Developer/Architect. Now you can approach the problem from either end. In one hand you can have a BA or End User mock up a Visio Diagram of what the process should be like and give that to the Dev/Architect, on another hand like I do, i often will stop after I stub out the process and put in the transitions and ASK the BDM’s .. “Is this what you want?” inside the Visio Diagram which is a lot friendlier than SharePoint Designer Text Based Viewer. So based on our examples above lets move forward.
Example 1 – Bank of Fabian
What you have above is the complete process flow of the Workflow in Visio Stencil, now lets dissect it.
Stages Breakdown
In the above you can see how Visio represents the shapes for SharePoint 2013 Workflows and ANYONE can do this, the stencil legend is below
The above represented the Visual Designer View which is all well and good, but there is even a simpler view that you can see that is called the Stage Outline view and that i believe you can take to anyone and they can really understand at a 10000 feet view what is going on, and you as the Developer / Architect can have some assurance you are on the right path.
End of Part 1 Summary
I am actually glad that I have broken this out, because it truly is a lot of content. It is my hope that the above illustrations, video and explanation will help you understand that it is a Brave New World out there for SharePoint Designer 2013 and this is just the scraps of it, Chicken feed, in PART 2 of this Blog, I will use what we have here and really open your eyes up on how you can make a ROBUST process engine that can make External Calls, be “State Machine – esque” and totally be NO CODE where before you certainly had to use CODE or a Third Party Product.
Stay Tuned…
SharePoint Evolution Conference 2013 Commentary
Fabian’s Take…
Like any great story, I will adopt some foreshadowing, in that I will tell you from the onset that, as mindblowingly exceptional as I expected the event to be, it surpassed every expectation I had. Indeed I was advised, “…pace yourself, each day gets better than the next…” and that advice was given on Sunday before the event kick started by AC @andrewconnell and CJ @LoungeFlyZ over brunch. By EOD Wednesday, I was enthralled with how Steve @SteveSmithCK Smith, Zoe Watson, and the rest of the Combined Knowledge Team assembled a well coordinated event, AAA+ Speakers, a well versed, knowledgeable, and engaged attendee base. Topping that off, as a speaker… man, believe me when I tell you it doesn’t get better than that, and while I can tell you stories about how good the Speaker Dinner event was, how the Event Social was captivating, its the subtle details like coming back from Speaker dinner to find a shoebox in your hotel suite with gifts and memorabilia to commemorate the event.
Guys, you did a fantastic job, Aces!!!
The Sessions are Awesome
So, while i cant find any pictures of my sessions, I was so excited to present, that I didn’t ask anyone to take a picture of the room, but hopefully one of my dear speaker colleagues & attendees took one that they can send to me, but for now, Ill showcase Andrew Connell’s session to which I attended, as well as a bunch of other top notch speakers.
and this is just one section filled with speakers ready to soak up knowledge
Can you pick them out… and behind me there were quite a few others as well. Great session by the way AC, cant wait for the blog post. My take away from that session was learning about Durandal and other JavaScript tools are out there to aid the C# Developer who has to now be a master of JavaScript.
The Social and Party Events
Well, you have to be there to experience it, many people have tried to explain it to me, and it was all mindblowing but this year (my first year you must understand) I have been told was EPIC. Ill try to share just a few things here in this post.
Event Social is below
Next Speaker Dinner which started out with a Duck Bus Tour on the River Thames by Parliament and back to our Dinner at the Tower of London.
This was all good, but because of the event of that day Members of Parliament were outside overlooking the Thames and of course, me being me, I waved to say hello, and guess what, a few waved back.. here is the video of that
After that we were scooped away to the Tower of London for Dinner where the place setting would meet Hyacinth “Bouquet” Bucket standards, the meal was excellent the company at the table superb, great place setting gang.
We were met by.. these folks
place setting below
During dinner we were captivated by real live accounts of World War II events by actual members of the armed forces who were present & had the medals to prove it, I forgot what these select few of individuals that are permitted to do this in the London Tower are called [as provided by Mark Stokes they are called Chelsea Pensioners], but as far as I know, there are only 36 of them in the world that have an award they all have, and we had 3 at our dinner. As a former armed forces member, i was so proud to take this picture below
In the last few days I got my Oyster Card, a Map, and took off to discover London, when you find me in person Ill tell you the rest, but trust me when i tell you whether you are an Attendee or Speaker, SharePoint Evolution Conference IS a MUST GO for you. My Slide Deck and Session will be made available via DVD, trust me if i gave it to you now it wont make any sense, because it was mainly DEMOS’ I love Demos as many of you already know.
Till the next time Cheers
and with this post my Blog is now back on WordPress
Why the move
After two plus (2+) years hosting my blog on SharePoint 2010, I have either missed out on a proper authoring tool that will keep my formatting, properly manage my photo uploads, and most importantly manage my comments in such a way that spam is at least kept to a minimum and provide me with good stats on site interactions.
Why now?
Well why not now? But I think the impetus stemmed from the fact that people still came to my WordPress blog even though it has officially been retired for like 2+ years and the stats have been phenomenal. How do you argue with stats like below, when nothing has been new on the site for some time.
What’s next?
So, over the next days, weeks, perhaps 1 month, i will be transferring the content of my SharePoint 2010 blog (http://www.sharepointfabian.com/blog ) site over to this blog (http://fabiangwilliams.wordpress.com ) and for now I will have a HTTP redirect to point folks here if they go to the SP2010 blog, I have 2 years of blogs over there, so it may take some time.
Theme change? Possibly
And after having this look and feel for that time, i think i may spruce it up with new themes and widgets, but that will come later on.
Upcoming Posts
And perhaps this is one major reason why i am doing this now, I want to blog my experience at the SharePoint Evolution Conference in London UK last week, and I really want to gather comments and feedback, both of which were not possible on my SP 2010 Blog site.
Summary
I still LOVE SharePoint, but after looking at the investments MS have put in to its Blog capabilities, which IMO is none… (and Im not talking Social here), its time to go back to a platform that makes such investments.
Chat to y’all soon, Cheers.
What is my session at SharePoint Evolution Conference about you ask
This blog serves to provide some insight on the session that I will be speaking on at the SharePoint Evolutions Conference that commences on April 15th 2013
What is the SharePoint Evolution Conference
For that, Ill give you two two point of references. (1) is my blog post on the fact that I have been invited to speak there, you may find it here and (2) is the link to the conference web site here. I will tell you this however right here, I have been told that if you attend any conference, this one should be at the top of your list. This is my first time, and i have goose pimples already
I will be in the Global Community Rutherford Room and my session is at 4:00pm – 5:00pm Local time on Monday, 15 April, 2013 (yes i went with the UK way of Calendar Dates lol)
What is my session about
I have been invited to speak on the new Community Track at the SharePoint Evolution Conference. The conference states "…One of the great things about Community sessions is that they always bring a new perspective on challenges and methods that companies have had to adopt in order to make SharePoint work for them. Real world, thought provoking and not always the obvious solution to a problem."
What you will see in this session is sanitized with a fictitious entity, however the essence of the work remains. process flow and all i.e. the integrity of the logic remains intact.
Business Process Reengineering
In a nutshell that is what my session about, but more specifically its Business Process Reengineering what was a manual paper process with the single communication vehicle being Email to a process where we have a totally push driven automated approach to the process. We will look at the Visio Charts that define the Requirements Analysis and how that ‘evolved’ over time. We will peek briefly inside the tooling that created these various solutions, we will NOT delve into code, this is not that kind of session, but Id be happy to do one like it, infact I have blogged some of those solutions bit by bit already, just not as one cohesive story. We will fire off the Workflow to see how it works for the pertinent bits and discuss the benefits that are provided in differing solutions. Finally I will show you what I have done in my spare time taking the same logic and redoing some of the efforts inside my Development Office 365 SharePoint Online and the amazing results in that exercise… yeah, it works! Using Workflow Stages in SharePoint Designer 2013 for ‘State Machine’ transitions and the new Looping capabilities therein as well, it wasn’t that hard…
Here is my Agenda
Timeline
The entire project, well, the project is still ongoing but it started in November 2012 and we are currently in Testing.
Iteration 1 – Explore OOB Solutions to accomplish the goals
Iteration 2 – Custom Code a Solution using Visual Studio 2010 on SharePoint 2010 On Prem
Iteration 3 – Use K2 Studio as a solution on SharePoint 2010 On Prem
My Vision – Use SharePoint Online Office 365 (SharePoint 2013) and SharePoint Designer 2013 ‘only’
Summary
So, on Monday 15 April 2013 for the Last Session of the day, come see this session, I know Im up against some big name too, so this is/was my pitch
I hope to see you there
Cheers.
Limitations when using SharePoint 2013 Workflows to return JSON data
Précis
I struggled with the title for this blog; dare i say, after spending almost two days trying to make SharePoint Designer 2013 and Visual Studio 2012 Workflow return data from a few notable providers [YouTube, Twitter, iTunes] using the Dynamic Value / Dictionary Data Type in JSON format, and not being able to as documented, i was frustrated to say the least. I would have been Ok, if it wasnt for the fact that the same exact Logic/Process works for other providers such as [FreeWeatherOnline, etc] returning data in JSON format, the key difference being the structure of the JSON data being returned.
This is for a few SharePoint Community Events that I have been scheduled to present this material. So after beating my head against the wall, sending out S.O.S tweets, and pinging a few folks that are versed on the topic, I ended up doing my Demos with the REST API provider that returns the JSON data in the way that works OOB and documented in both SharePoint Designer 2013 (SPD2013) and Visual Studio 2012 (VS2012). Nevertheless, this was going to haunt me if i cant get it to work, so i went back at it and with the help of Bart @bart_tubalinal Tubalinal who is the self professed and "fabian validated" Pound for Pound Undisputed Developer in the World, we proved out that if you altered the return JSON data from the providers that didn’t work as expected, and then make a call from SPD2013 and VS2012 using the DynamicType / Dictionary variable, it worked as expected.
I will describe the process we used to determine this below…
Background Research
Below, I will show you three data calls to REST API providers returning in JSON format, showing you both in the browser and in the JSON viewer, I call your attention especially to the JSON viewer and the hierarchy.
Screen clipping: Google YouTube API Above
Screen clipping: FreeWeatherOnline API Above
Screen clipping: Twitter API Above
Screen clipping: YouTube JSON Data Returned Above
Screen clipping: FreeWeatherOnline JSON Data Returned Above
Screen clipping: Twitter JSON Data Returned Above
Hypothesis
What we found out is that if you have anything under the Root of the JSON node other than a JSON Array, for example as in the case of a few, the Version Number [returned as a JSON Object], although it works perfectly in a browser, or JSON Viewer, or Fiddler, it doesn’t make the right call when using SPD2013 or VS2012. If after modifying the data output and removing anything that is NOT a JSON Array from the Root of the Node, it should work as expected.
The first thing to prove it out is to have SPD2013 or VS2012 make a call to a URI that returns JSON, so that can easily be accomplished via Visual Studio Project to create a new Site, and then drop a file with the removing anything in the root that is not a JSON Array (Collection) and calling that Web Site from inside for example SPD2013 then it should return the requisite data than can be consumed by the Dictionary Object.
Test/Prove Out
To begin, the first thing we need to do is remove the "appVersion: 2.1" JSON object out of the data returned, below is what is looks like without any adjustment
after you remove it, the raw file looks like below
just to verify, ill put it into a JSON Viewer to make sure it is what i want
then drop that raw file into a text document and place it at the root of the newly created Visual Studio Project Web Site
verify that you can get to it from a browser call
Analysis
Now, below I will show you WITHOUT adjustment how the FreeWeatherService REST API works right off the bat, you will recall above that the only thing at the JSON root node is the JSON Array. So we put it into SharePoint Designer as below
Screen clipping: See the URI and Process Above
Screen clipping: Above you’ll notice the return data goes to the Dictionary DataType
So after you publish the Site Workflow and run it on the Site, you get what you expect to see below
Screen clipping: SharePoint Promoted Links List with JSON Data Returned
Showing the YouTube Working with the Mods to the Data Set and Without the Mods
So, below you will see how we make a call to the Virtual ASP Visual Studio Site [look at the URI call line you will see it set to localhost and port number]
Screen clipping: SPD2013 WF with the Modded JSON data call Above
After publishing the Site Workflow to the Promoted Links List we can see the output works as expected.
Screen clipping: Promoted Links List showing the Top 10 YouTube Videos displayed with Modded JSON data Call
Now Showing it NOT working as Expected
Below you will see the same code as in the one that worked, except the URI is set to the Google YouTube REST API and no Mods will be done to this data set.
Screen clipping: Above the same Logic/ Process except this call is made directly to the YouTube REST API
Now pay attention to the logging above, you will see that when the Workflows is published and deployed and ran, that the line for the call fails.
Screen clipping: Above is me executing the Site Workflow
Below you will see the Workflow status showing that the process halted
Screen clipping: The Workflow Status showing it didnt work
Report
So, I originally called this a BUG, but for now it is just an observation. Ill be happy to know from our community folks, MVPs, MCMs, and other folks that come across this blog your thoughts. Sadly, I have turned off comments on my blog, but you can always shoot me a tweet at @fabianwilliams
thanks cheers.
Other Notables but I wont write it up, you can discern yourself
See me making it work in a Custom Action and also Not working using one REST API result that is in the format I said will work, and the other with it not.
Screen clipping taken: 12/31/2012 3:32 PM
Screen clipping taken: 12/31/2012 3:32 PM
Screen clipping taken: 12/31/2012 3:34 PM
Solving Recursive Loops in SharePoint Designer using SandBoxed Solutions
This is a blog post that I looked forward to writing; this post deals with a problem that has plagued SharePoint Workflows when limited to using SharePoint Designer, and a solution is here now in SharePoint 2010 using Sandboxed Solutions. What problem is this you may ask, well it is the means by which you implement a loop structure in your workflow, you may notice that here is no such activity as an available option in SharePoint Designer 2007 or 2010, hmm I wonder will it be in the next version? J Inquiring minds want to know.
Problem Stated
You have two SharePoint Lists, data elements in List A are related to data elements in List B. You want to make a change to a singular item in List A and for every related element in List B, you want to effectuate a change as well.
In practical terms lets say that you have a pool of candidates that you plan to hire, those candidates are in List A, they will go through a list of interviews with individuals and teams. You want a workflow such that if (1) During the process, the candidate drops out of consideration [Cancelled], is put on a wait list [Deffered], or “knows someone” so they don’t need all those formalaties[Approved].. I know im stretching on the last one. But basically you want it, for as many people involved in that process [List B], for it to update the status of that candidate to those (for now) Deffered and Cancelled status.
How would you do it if you were limited to creating the workflow in SharePoint Designer 2010?
Above: List A – The Candidates Table (Before Shot)
Above: List B- The Interview Board Tasks (Before Shot)
Solution Design
Now, there are several post and guidance’s out there in the Blog-osphere that speak to solutions that employ using Multiple List and Libraries to act as counters with delay activities to ensure that the timing is maintained between iterating through the items in LIST B when the helper table managing the counter is in a work state; now I have my opinions on those solutions, but notwithstanding that, I fully understand that those solutions in the past were necessary in order to get the job done. Enter today with SharePoint 2010 and Sandboxed Solutions; this affords us the ability to write targeted solutions that are scoped at the Site Collections level and accessible through SharePoint Designer tooling, here is an excerpt of what a Sandboxed Solution is taken from Microsoft’s site.
“A sandbox is a restricted execution environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment. Solutions that you deploy into a sandbox, which are known as sandboxed solutions, cannot use certain computer and network resources, and cannot access content outside the site collection they are deployed in. For more information about solutions, see Solutions Overview(http://go.microsoft.com/fwlink/p/?LinkID=156638).”
Approach
Using Custom Workflow Activities, create a loop structure to look for changes in List A (on changed event fires) and then traverse List B, looking for the qualifying criteria that will count as a match in List A, then update that item. Loop through the entire list until all every list item has been evaluated. This logic will be encompassed in a Method of a Class you will create, the class must be scoped “public” and the method will take as a parameter “SPUserCodeWorkflowContext” object and it will return a type of Hashtable, also remember that your feature needs to be Scoped at “Site”.
- Create a Visual Studio Empty SharePoint Project that is Scoped to the Sandbox
- Create Logic to use the SharePoint API to traverse items in List B based on changes in List A
- Deploy the Solution, open up SharePoint Designer for the Site Collection it is Activated on
- Use the Custom Activity in SharePoint Designer as you would for any other OOB Activity
Build
- Create your SharePoint Project
Begin by launching Visual Studio and create an Empty Project, scoped at Sandboxed Solution in the Project Properties or as you are setting up your Project for the first time. Next add a Class to create the method.
You are not over quite yet, now you need to make this available to SharePoint Designer, we do that by adding an Empty Module to our project. In my example below I am calling it CASDefinition and it includes and Elements.xml file that I will modify as such…
You will notice that the structure of the file lends itself to how it will be viewed and used in SharePoint Designer; also there is a reference to the class file function names, class names[lines 4 through 8], what category (placement)[my self serving line 10] it will appear in SharePoint Designer. Next you have parameters, now certainly here I could have made this configurable by taking the List name as an input Parameter or maybe a specific parameter that I wanted to update rather than all, but this is a demo, you get the idea, for now I have an output parameter.
By now, your project should look like this below.
A few housekeeping notes here, I did mention it above but just to re-inforce it, please change the Feature File to “Site” Scope so it is available at the Site Collection level, and you can see in the project properties that the “Sandboxed Solutions” property is set to true. One more thing, you will see that there is another project in there, “CASTester”, that is just a console app I use for testing ANY solution logic, it is not necessary for this to work.
Assemble your SharePoint Designer Workflow
Now that you have deployed your package, you should see it as an available option in SharePoint Designer 2010 under Workflow Actions.
Notice the Fabian Custom Actions section and the Name of the Custom Workflow Activity therein. Now at this point you can set this workflow to run on a Changed Event in List A, or set it for Manual, either way, when it runs, it will subsequently change all items related in List B accordingly.
Above: List A – The Candidates Table (After Shot)
Above: List B- The Interview Board Tasks (After Shot)
Conclusion
So now you have a tried and tested way of doing Loops in SharePoint Designer 2010 albeit through a Custom Workflow Activity within the boundaries of a Sandboxed Solution in SharePoint 2010.
Cheers, happy SharePoint-ing







































