Conditional Workflow Activity

Hello,
We have created our own "change user password" workflow to include two new activities. One is to unlock the users other resources on a password change and the second is notify the user that they have changed their password.
     <Activity id='2' name='Reprovision'>
        <Comments>
          Since passwords have all been stored in the WSUser
          object, all we have to do here is reprovision.
        </Comments>
        <Action id='0' process='Provision'>
          <Argument name='op' value='reProvision'/>
        </Action>
        <Transition to='UnlockAD'/>
      </Activity>
      <Activity id='3' name='UnlockAD'>
        <Comments>
          On Success do a global unlock .
        </Comments>
        <Action id='0' application='com.waveset.session.WorkflowServices'>
          <Argument name='op' value='checkoutView'/>
          <Argument name='type' value='Unlock'/>
          <Argument name='id' value='$(accountId)'/>
          <Argument name='subject' value='<ADMINUSER>'/>
          <Argument name='authorized' value='true'/>
          <Return from='view' to='myview'/>
        </Action>
        <Action id='1'>
          <expression>
            <block>
              <set>
                <ref>myview.global.accountLocked</ref>
                <s>false</s>
              </set>
            </block>
          </expression>
        </Action>
        <Action id='2' application='com.waveset.session.WorkflowServices'>
          <Argument name='op' value='checkinView'/>
          <Argument name='subject' value='<ADMINUSER>'/>
          <Argument name='authorized' value='true'/>
          <Argument name='view' value='$(myview)'/>
        </Action>
        <Transition to='Notify User'/>
      </Activity>
      <Activity id='4' name='Notify User' audit='true'>
        <Variable name='user'/>
        <Variable name='toAddress'/>
        <Action id='0' application='com.waveset.session.WorkflowServices'>
          <Argument name='op' value='getView'/>
          <Argument name='type' value='User'/>
          <Argument name='id' value='$(accountId)'/>
          <Argument name='subject' value='<ADMINUSER>'/>
          <Argument name='noFetch' value='false'/>
          <Argument name='TargetResources'>
            <list>
              <s>Lighthouse</s>
            </list>
          </Argument>
          <Return from='view' to='user'/>
        </Action>
        <Action id='1' process='Notify'>
          <Argument name='notificationRetryCount' value='$(notificationRetryCount)'/>
          <Argument name='notificationRetryWait' value='$(notificationRetryWait)'/>
          <Argument name='notificationRetryResult' value='$(notificationRetryResult)'/>
          <Argument name='notificationException' value='$(notificationException)'/>
          <Argument name='template' value='PasswordSyncNotification'/>
          <Argument name='toAddress'>
            <ref>user.waveset.email</ref>
          </Argument>
        </Action>
        <Transition to='end'/>
      </Activity>
      <Activity id='5' name='end'>
      </Activity>The problem is that if the user does not have any other resource accounts (such as AD) we receive the following " Operational error"
"The following error occurred:com.waveset.util.WavesetException:User has no resource accounts that support the Unlock feature."
Question:
How would I go about making <Activity id='3' name='UnlockAD'> only execute if the user has an AD account or an account on a resource that supports the Unlock feature?

Two ways:
1) You can add a <Condition> tag under your <Action> tag. That is basically a true / false filter to the action.
Something like:
             <Activity name="Next">
                <Action>
                    <Condition>
                        <eq>
                            <ref>accountblah</ref>
                            <s>Some String</s>
                        </eq>
                    </Condition>
                    ... rest of your action code
                </Action>
                <Transition to="Other"/>
            </Activity>2) You can control flow into your activities using the transition element:
<Transition to="Unlock">
    <eq>
        <ref>myflag</ref>
        <s>something</s>
    <eq>
</Transition>
<Transition to="DoNotUnlock"/>Edited by: MichaelF on Jul 16, 2009 9:00 AM

Similar Messages

  • How to get a substring in a Workflow Activity?

    I'm concatenating some values into a Summary field in a workflow activity as follows:
    IIF(Eq([//Target/Code1],True),"1,","")+IIF(Eq([//Target/Code2],True),"2,","")+IIF(Eq([//Target/Code3],True),"3,","")
    So if Code1 and Code2 are true I get a Summary Value of 1,2,
    Now I want to trim the trailing comma.
    So I did this
    Left([//Target/Summary],Add(Length([//Target/Summary]),-1))
    This part doesn't work.  It says Left is improperly formatted or missing a parameter.
    If I put a numeric value like 1 or 2 as the second value it works.
     Any suggestions on how to get trim a character off the end of a string in a FIM Workflow activity?

    Length isn't a function supported by the FIM Function evaluator Workflow activity. (Which is frustrating).
    Here is my sloppy approach using the built-in tool (lots of nesting so if you need to do this for more than 3 conditions this grows out of control):
    IIF(Eq([//Target/Code1],True),IIF(Eq([//Target/Code2],True),IIF(Eq([//Target/Code3],True),"1,2,3","1,2") ,IIF(Eq([//Target/Code3],True),"1,3","1") )
    ,IIF(Eq([//Target/Code2],True),IIF(Eq([//Target/Code3],True),"2,3","2") ,IIF(Eq([//Target/Code3],True),"3","") ))
    OR you can use one of these custom workflows that allows you to run your own code:
    http://fimwf.codeplex.com/
    or
    https://fimactivitylibrary.codeplex.com/wikipage?title=Code%20Run%20samples&referringTitle=Documentation
    David Lundell, Get your copy of FIM Best Practices Volume 1 http://blog.ilmbestpractices.com/2010/08/book-is-here-fim-best-practices-volume.html

  • Shopping cart's One step approval workflow activation

    Hi Gurus,
    Please reply me for, how to create a shopping cart with One step approval workflow activation?
    regards,
    George.

    Hi George,
    The creation of the SC stays the same. Only the event linkage and the start conditions determine which workflow will be started.
    Regards,
    Martin

  • Workflow Activity "Lookup Value" returns An error occured while enumerating the filter using [//WorkflowData/customvalue]

    I want to generate an Accountname using EmployeeID, FirstName and LastName via a workflow.
    I'm using the Granfeldt Workflow Activity Library (https://fimactivitylibrary.codeplex.com/)
    I'm using the FIM Powershell Workflow Activity (https://fimpowershellwf.codeplex.com/)
    Steps:
    Passing the EmployeeID, FirstName and LastName to the powershell Activity, generating a logonid based on logic.
    Add-PSSnapin FIMAutomation
    $EmployeeID = $fimwf.WorkflowDictionary.EmployeeID
    $Forename = $fimwf.WorkflowDictionary.Firstname
    $Lastname = $fimwf.WorkflowDictionary.Lastname
    'logic creating a custom logonid here
       ==> This works
    Returning data back to the workflow via that powershell script:
    $fimwf.WorkflowDictionary.Add('NewAccountName',$newlogonid)
       ==> This works
     Using Lookup Value Activity to read the Workflow data and update the [//Target/AccountName] fails.
    This gives an error:
           An error occurred while enumerating the filter 'string' .
    (where string is the actual generated userid that I've got back from the powershell script. Example dab2563)
    I tried with only [//WorkflowData], then this gives the error:
          Index was outside the bounds of the array.
    Any hints to solve this?    
    Kind regards,
    David

    The Lookup Activity is for looking up an object in the FIM Service. Seems like thats not what you're trying to accomplish.
    For updating the target of the workflow, just use the built-in Function Evaluator. The Lookup WF was not built for that and it is failing because you have not specified a valid XPAth lookup filter, such as /Person[AccountName='BillG']
    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt

  • Unable to register custom workflow activity on MS CRM 2015 Online

    Hi All,
    I am trying to register custom workflow activity using plugin registration tool on MS CRM 2015 Online.
    Error says that 'No Plugin have been selected from list. Please select atleast one and try again'
    In short my assembly is not considered as custom workflow activity.
    I am giving my code let me know, If any thing is wrong.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Activities;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Workflow;
    namespace Training.SamplePlugin
        public class SampleCustomworkflow : CodeActivity
            [Input("Birthday")]
            public InArgument<DateTime> BirthDate { get; set; }
            [Output("NextBirthday")]
            public OutArgument<DateTime> NextBirthDay { get; set; }
            protected override void Execute(CodeActivityContext executionContext)
                //Create the tracing service
                ITracingService tracingService = executionContext.GetExtension<ITracingService>();
                //Create the context
                IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
                IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
                if (context.PrimaryEntityName.ToLowerInvariant() == "contact")
                    DateTime birthDate = BirthDate.Get<DateTime>(executionContext);
                    DateTime nextBirthDate = new DateTime(DateTime.Now.AddYears(1).Year, birthDate.Month, birthDate.Day);
                    //NextBirthDay.Set(executionContext, nextBirthDate);
                    Entity newContact = new Entity();
                    newContact.LogicalName = "contact";
                    newContact.Id = context.PrimaryEntityId;
                    newContact["new_nextbirthday"] = nextBirthDate;
                    service.Update(newContact);
    If code is correct then has somebody faced this kind of issue earlier, what is resolution.
    Thanks
    Apurv

    Have your signed your assembly ??
    Microsoft Dynamics CRM Training|Our Blog |
    Follow US |
    Our Facebook Page |
    Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

  • How to make the condition type active

    hi,
    how to make the condition type active when its in inactive stage and its showing yellow triangle and y in the control features of it.
    and
    how to solve if is showing a statement as "INITAILISED".
    regards,
    balajit

    Dear Balaji,
    Yes it will come as Inactive mode.....If you make the 2 condition Class is same in single Pricing procedure ,In Standard system will display like this only..
    For Example:PR00-Condition class is Price
    EX00-Condition class is Price
    Then first Condition type will become Inactive.. change the Class of the Second Condition Type.
    Best Regards
    raj.

  • Approve quote to be ordered based on workflow activity assigned to the user

    hi,
    how to approve the quote(cart) to be ordered when user clicks place order based on the workflow activity assigned to the user.
    regards
    yesukannan

    Thanks for the quick response.The workflow rule will work only for certain combinations.
    I am trying to avoid using different combinations of the word "Convention Center" in the workflow rule since the word convention center could be spelled with mixed cases by the sales people.For example - Convention center or convention Center or CONVENTION center.
    I don't want to check for the different combinations of the convention center string in the workflow rule since i need to check for other fields in the opportunity and the expression could get very long.
    I am trying to convert the opportunity to upper case and then check for 'CONVENTION CENTER' so that it will handle all the scenarios.
    Thanks
    Swami

  • Result row when condition is active

    Hello gurus,
    I have created a condition in my report and the result row does not reflect the rows displayed when condition is active. Is it possible to get a result which is the total of rows displayed when condition is active ?
    Thanks in advance,
    Vanina

    Hi Vanina,
    You can go through the steps here:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/78a03c1178ad2ce10000000a114084/content.htm
    Basically you have 2 queries that are linked by a replacement path variable. This will carry the results (char values) of the pre-query to the resultset (final) query.
    Hope this helps...

  • Highlight an invalid email address in a custom workflow activity in SharePoint Designer 2010

    Hi,
    I have created a custom workflow activity to send an email with the 'From' address being taken as input from the SharePoint Designer when this activity is used in a designer workflow. My requirement is to highlight an invalid email address(from address)
    on click of 'Check for Errors' button in SharePoint Designer like it is done for mandatory inputs by default where it highlights such inputs if left blank. Is it possible?
    Thanks in advance.

    Good work, catch so far Michael, does seem to be a "feature" of iCloud syncing, not sure what you could do to disable it.

  • Custom Workflow Activity not showing in Plugin Registration

    Could anybody suggest what I am doing wrong here?
    I have created a Custom Workflow Activity using this sample
    Create a custom workflow activity. But this is not showing up as a plugin/activity type in Plugin Registration Tool. See image below:
    My sample code for the activity below:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Activities;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Workflow;
    namespace TestCustomWorkflowActivity2
    public class SampleCustomActivity : CodeActivity
    protected override void Execute(CodeActivityContext executionContext)
    //Create the tracing service
    ITracingService tracingService = executionContext.GetExtension<ITracingService>();
    //Create the context
    IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
    IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
    Platform
    Dynamics CRM 2013 On Premises v 6.1.2.112 (SP1 UR2 installed)
    Dynamics CRM 2015 Online
    .NET Framework version
    4.0
    Thanks and Regards,
    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

    Hi,
    I can see only one difference with my code:
    I placed using detectives in namespace:
    namespace Crm_RTB_NewAcc.Workflow
    using System;
    using System.Activities;
    using System.ServiceModel;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Workflow;
    using Microsoft.Xrm.Sdk.Query;
    public sealed class GetOrgLicense : CodeActivity
    // Define Inputs/Outputs
    [Output("Count")]
    public OutArgument<int> Count { get; set; }
    protected override void Execute(CodeActivityContext executionContext)
    //My code here
    Count.Set(executionContext, 5);
    Try to make same code. It working well. 
    Hi xjomanx,
    I just tried your suggestion, but still the class is not appearing in the plugin registration. Btw, could you please confirm what version of PluginRegistration you are using?
    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

  • State machine site level workflow activated but not showing in the workflow list

    I developed my state machine workflow using visual studio 2010 its successfully deployed; even I can see the feature is activated on site collection level, but its not showing in the list settings --> workflow settings --> add workflow Any Reason ??
    note: I am working on share point 2010
    Nazish Ali Rizvi

    Thanks Bhavik,
    I got the answer , actually I didn't experience it before with site workflows , it shows where we create a list just beside you can find site workflows, off course feature activation is necessary after that for workflow activation this is the way.
    http://www.codeproject.com/Articles/416393/Create-a-Workflow-using-Visual-Studio
    this is also a helpful article.
    Nazish Ali Rizvi

  • How to Rewind the workflow activity using PL/SQL API?

    Hi,
    Is there any API to Rewind the workflow activity instance? We have some timedout activities and wanted to Rewind them to the start. I can Rewind them manually from the Admin responsibility, but we have to do this in a program for some cases.
    The Background process runs with the parameter timedout = No.
    Thanks in advance.
    Regards,
    Ram

    Hi,
    Yes - you need to use WF_ENGINE.HandleError to restart from the correct point.
    There is a white paper on my blog here which explains how to do it.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://www.workflowfaq.com/blog ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • How to call an Azure Web API (2.2) - from Dynamics Custom WorkFlow Activity of Plugin c#

    Hello,
    I am specifically trying to call a web api, that has a FromBody.
    However, I am trying to do it without having to use libraries (or nuget packages) that I cannot install on CRM of CRM Online.
    It seems JSON newtonsoft is big... or I guess I could use my own custom formatter...
    But I would love to see if someone has an example for posting to web API, versus an ASMX
    Thanks

    Wow I had this awesome thing typed up... and it wouldn't do it then wanted me to verify and then that messed up and I lost it all... Wow..
    Anyway
    [SOLVED]
    Works from Plugin or Workflow activity
    Use the Query string to pass things (not the body) or else you have to compress it and you can't use the libraries to DO that in the Sandbox... You CAN do that if you or on premise and do NOT isolate.. Then heck I did everything I wanted but for online
    this was it.
    You do NOT have to use WebClient, use HttpClient (follow the code below)
    WebApi 2.2 is what I used
    My signature for Webapi
    You do have to clean up the response.. as the string you get back is JSON.. and you cannot use the JSON desieralizer...
    Easy fix... just do a replacement of the \ and " to a " " space.. then Trim the result.. bingo a clean string response...
    [HttpGet]
    Public string MyMethod(string value1, string value2, string value3)
    This will parse the query string so USE these are your parameters in your query string or the API will NOT work. ?value1=ddd&&value2=ddd&&value3=aaa
    of course make up your own string names
    IIS and Apache etc work differently so the AMOUNT of data you can send will differ per platform, per version of platform AND usually you can configure it.. IIS used to be like 2048 by default.. anything beyond that (as a total URL incoming) was truncated..
    Not sure now. I know it was configurable
    I got it working.. all my points are gone... but it's possible
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Activities;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Workflow;
    using Microsoft.Xrm.Sdk.Query;
    using Microsoft.Xrm;
    using System.Net.Http;
    using System.IO;
    using System.IO.Compression;
    using System.Net.Http.Headers;
    using System.Runtime.Serialization.Json;
    using System.ServiceModel;
    using System.Net;
    try
        string result = string.Empty;
        using (var client = new HttpClient())
            client.BaseAddress = new Uri(webapihost);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
            client.Timeout = new TimeSpan(0, 0, 30); ;
            client.MaxResponseContentBufferSize = 2000000;
            using (HttpResponseMessage response = client.GetAsync(webapihost + apimethod + querystring).Result)
                if (response.IsSuccessStatusCode)
                    result = Decompress(response);
                    tracingService.Trace("Call Data Value [{0}]", result.ToString());
    catch (Exception simple)
        throw new InvalidPluginExecutionException("Error with simple HTTPClient x-www-form-urlencoded" + simple.ToString());
    private string Decompress(HttpResponseMessage response)
        try
            switch (response.Content.Headers.ContentEncoding.ToString().ToLower())
                case "gzip":
                        return DecompressGzip(response.Content.ReadAsStreamAsync().Result);
                case "deflate":
                        return Inflate(response.Content.ReadAsStreamAsync().Result);
                default:
                        return response.Content.ReadAsStringAsync().Result;
        catch (Exception ex)
            throw new Exception("Error decompressing: " + ex.ToString());
    private string DecompressGzip(Stream datastream)
        try
            //Create a new stream
            //decompress the original
            //get back the string (JSON)
            if (datastream != null)
                Stream decompressedStream = null;
                decompressedStream = new GZipStream(datastream, CompressionMode.Decompress, true);
                var streamReader = new StreamReader(decompressedStream);
                string stringdata = streamReader.ReadToEnd();
                decompressedStream.Dispose();
                return stringdata;
            else
                return string.Empty;
        catch (Exception ex)
            throw new Exception("Gzip error: " + ex.ToString());
    private string Inflate(Stream datastream)
        try
            if (datastream != null)
                Stream decompressedStream = null;
                decompressedStream = new DeflateStream(datastream, CompressionMode.Decompress, true);
                var streamReader = new StreamReader(decompressedStream);
                string stringdata = streamReader.ReadToEnd();
                decompressedStream.Dispose();
                return stringdata;
            else
                return string.Empty;
        catch (Exception ex)
            throw new Exception("Inflate error: " + ex.ToString());

  • Conditional workflow

    Is it possible to define conditional workflow in ODI package. For example if Var1=10 then execute step1 else if Var1=20 then execute step2 else execute step3.I dont see any tool to define conditional flow in ODI. I belive there is only next step on success or next step on failure. Is there any way to define next step based on condition?
    Thanks in advance

    Yes. Use ODI variables in the package. In the package drag the variable in once to make a DECLARE variable step, then drag it in again to make an EVALUATE variable step, then drag it in again to make an EVALUATE variable step - here you can have one evaluate (e.g. = 10 or in 10,11,12) and this step has two exits TRUE and FALSE. If the expression evaluates to TRUE it goes down the OK line, else the KO.
    Use a PACKAGE, and ODI VARIABLEs.
    Craig

  • Workflow activation

    Dear experts,
    As a part of Data migration uploading, local contract approval workflow has de-activated.
    Now the same client we are using for UAT, I want to re-activate the workflow.
    Can any one explain me how to activate the contract approval workflow.
    Thanks in advance,
    Regards,
    Krish

    SPRO-->
    Cross-Application Basic Settings u2192 SAP Business Workflow u2192 Perform
    Task-Specific Cusomizing
    SAP u2192 SRM u2192 SRM-EBP u2192 SRM-EBP-WFL
    Activate event linking
    search what wf you want to activate
    select your wf flow
               - WS14000086 (Automatic approval)
             -   WS14000088 (One-step approval)
             -   WS10400022 (Contract alert)
             -   WS14000148 (n-step approval)
    click and event linkage flag  and save now it shows  e Green .
    Note: - make ensure that among which wf you want to activate. if you activate more than one wf, you need to specify starting conditions for wf...
    regards
    Muthu

Maybe you are looking for