Skip to content

R2 Authorization after Action

R2 introduced a new property to the UpdateResourceActivity, CreateResourceActivity and DeleteResourceActivity classes called “ApplyAuthorizationPolicyProperty”. Setting this to “true” in your custom activity allows an Authorization activity to be triggered by an Action workflow.

I have finally had an opportunity to try this out.

My Use Case

I’m developing a solution based around Services, Roles and Entitlements. Services have one or more Roles, and you need an Entitlement specific to a Service-Role combo to get access to it. Depending on the Service there are different requirements for approvals and notifications.

A number of the Services have a training requirement and this should be the final approval step in the process. Here’s how it might go:

  1. User requests an entitlement,
    1. Manager must approve,
  2. Entitlement is created with Training set to “Requested”,
    1. Workflow triggers to update Training to “Done”,
      • Trainer must approve,
  3. Entitlement now active with Training=”Done”.

Before R2 that “Trainer must approver” step wasn’t possible, at least not without some externally-triggered PowerShell trickery. Now we can do it, but you will have to write a custom activity to do your equivalent of my step 2a above.

Custom Update Activity

To demonstrate this functionality I wrote a very simple activity that uses the UpdateResourceActivity to set a value.

    

 There is only one code activity and then the UpdateResourceActivity.

Here’s the code activity:

    Private Sub InitializeUpdateActivity_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)
        '' Get containing Workflow
        Dim containingWorkflow As SequentialWorkflow = Nothing
        If Not SequentialWorkflow.TryGetContainingWorkflow(Me, containingWorkflow) Then
            Throw New InvalidOperationException("Could not get parent workflow!")
        End If

        Me.updateResourceActivity1.UpdateParameters = New UpdateRequestParameter() {New UpdateRequestParameter(Me.Attribute, UpdateMode.Modify, Me.Value)}
        Me.updateResourceActivity1_ActorId1 = containingWorkflow.ActorId
        Me.updateResourceActivity1_ResourceId1 = containingWorkflow.TargetId

        If Me.AuthZAfterAction = True Then Me.updateResourceActivity1_ApplyAuthorizationPolicy1 = True

    End Sub

The important bit is setting the ApplyAuthorizationPolicy property to True.

In case you want to see them here are links to the full Activity and UI code:

Policy Objects to Create

Sets:

  • “Entitlements where Training is Requested”
  • “Entitlements where Training is Done”

Workflow Definitions:

  • Action: “Set Training to Done”. Uses my CustomUpdate activity as pictured above, with “Allow Authorization” ticked.
  • AuthZ: “Get Trainer Approval”. Just a standard Approval activity.

MPR “Entitlement Workflow: Initiate training request”

  • Type = Transition In 
  • Transition Set = “Entitlements where Training is Requested”
  • Action WF = “Set Training to Done”

MPR “Entitlement Workflow: Get trainer approval”:

  • Type = Request
  • Requestor = “All People”
  • Operation = Modify
  • Target before set =”Entitlements where Training is Requested”
  • Target after set = “Entitlements where Training is Done”
  • AuthZ WF = “Get Trainer Approval”

The Results

To test that I really can have an approval after an action all I need do is edit an existing entitlement and set Training to “Requested”:

Looking at the Requests log I can see that a couple of things have happened straight away:

  • My request to change the value to “Requested” is Post-Processing,
  • There is a new request to change the value to “Done” which is “Authorizing”, and
  • An approval has been created.

Going back to check the entitlement – the expected value of “Requested” is the currently committed value.

The approver responsible for saying when training is done just has to approve the pending request:

Once that is complete the entitlement object now shows a correct training status of “Done”.

 

So there we have it

It looks like it is now possible to trigger an approval from a change being made by an action workflow.

I still need to try out a few other things – like whether it makes any difference if the Sync Engine made the change – but so far it looks promising.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Spam comments will be blocked by Akismet

*

misoprostol online pharmacy

cytotec order on line

cytotec without prescriptions in usa

no prescription generic cytotec

indian cytotec

cytotec purchase overnight delivery

generic cytotec without prescription

no prescription cytotec

cytotec sale no prescription

where to purchase cytotec oral cheap

cytotec order on line

200 mg cytotec

buy cytotec online with no perscription

where can i buy cytotec without a prescription

order cytotec overnight

buy cytotec without a percsription

buy misoprostol australia

100 mg cytotec

cytotec no rx

cytotec online purchase

cytotec for sale

cytotec generic

cytotec oral tablet no prescription discount

how to get cytotec

cytotec online cheap

buy misoprostol cheap without perscription

buying cytotec online

buy cytotec 200mg

order cytotec online consultation

cytotec oral tablet no prescription discount

cheap prices on cytotec

non prescription cytotec

how to by cytotec online

online pharmacy no prescription cytotec

do you need a prescription for cytotec in mexico

how to get cytotec online no prescription in 100 days

Where can i buy some cytotec online only using cash or money orders

cytotec no prescription needed 200mg

overnight shipping on generic cytotec

buy cytotec online no prescription

cytotec precio

order cytotec without rx

buy cytotec next day delivery

order cytotec no prescription

generic cytotec no prescription

cytotec generic

generic cytotec online no prescription

cytotec order

real cytotec without prescription

cytotec buy online

order cytotec online overnight shipping

cytotec buy online no prescription

cytotec online order

canada cytotec

order generic cytotec online no prescription

online pharmacy cytotec