Thursday, September 30, 2010

Getting User Information - Advanced Workflow Features

Oracle Enterprise Content Management uses a built in Workflow tool for routing documents to individuals or groups of users for approval/rejection and editing.  While workflows can be created with predefined user participants, it is best to use Aliases or Tokens. 

·       Aliases are groups of users, managed through the ECM User Administration tool, which allows administrators to group people for a particular task or for notifications. 

·       Tokens are extremely powerful variable-like objects which administrators can use to dynamically set workflow participants.

A common use case for Tokens is in the development of AdHoc workflows.  When a user checks in a document, they can use Metadata to select an alias or user to participate in the workflow for that document.  However, tokens can be used for more advanced workflow tasks. 

Within Workflow steps, there are three levels of events that administrators can use for extended functionality and business processing of workflow logic. 

·       Entry Event is used to evaluate content conditions as the document is just entering the workflow.  For example, if a document was rejected from another step and the rejection logic routed it to this particular step, the Entry Event could test for rejection and update a metadata field.

·       Update Event is used to evaluate content actions while the document is in process of the current workflow step.  For example, if an administrator wants to automatically approve a document which is edited by a particular user during the step, this event would facilitate that.

·       Exit Event is used to evaluate content conditions as the content is leaving a particular workflow step.  For example, if an administrator wants to update a metadata field of a document as it is leaving the workflow, maybe changing a custom metadata field of xstatus to approved, this is the event where those tasks can be performed.

In some cases, Components may be required to enhance the out-of-the-box functionality of the ECM.  Components are modular programs written in IDOC script, JAVA, or a combination of the two that adds new functions to the application or enhances/alters what was originally created.  An example of a custom component might include adding an icon to Search Results if a document has an associated Discussion (See next week’s blog for an example of how to do this).

The following is an advanced example of using both Tokens and Workflow Events along with a custom Component.

Situation: An administrator wants to create a workflow where the participating users are dynamically derived based upon  a particular Security Roles that users belong to.

Issue:  UCM variable like UserName, UserFullName, UserAddress, and functions like getUserValue, getValueForSpecifiedUser, isUserOverrideSet, userHasAccessToAccount, userHasGroupPrivilege, and userHasRole only retrieve information about the currently logged in user.  As the Situation statement indicates, the administrator wants to test against all users to determine which user has a specific role and add those users to the workflow step.  The desired information is not currently available in the ECM. 

Solution: In order to facilitate the request, we need to first create a new Custom Component, create a Workflow Token, and create a workflow Entry Event.

Creating the Component:

1.       Luanch the Component Wizard application and select Add from the Component List window.  Make sure the Create New Component checkbox is checked and name the Component Workflow_Example.

2.       We will create a query that will enable administrators to query against the usersecurityattributes table then provide a result set that can be looped through to find the desired users.  Click on Add and select the radio button for Query.

After clicking Next two times, we can add the Query name, calling it quserattribute (as best practice, always start query names with q). On the next screen, enter the query script and a parameter to pass into the query script: select dattributename from usersecurityattributes where dattributetype = 'role' and dusername = ?.

Click Ok to continue

Click OK to continue. 

3.       Next, you will need to create a service which calls the query and stores the information into a specific Result Set.  From the main page of the Component Wizard, click Add on the left and select Service.

Click Next two times.  Name the new service find_user and assign the DocService as the service class.

Make the Access Level Read and Scriptable.  Next click the Add button.  On the next screen, make Type equal Select cache query, Action equal quserattribute, enter NameLoop in the parameters box, and check box for check result non-empty.  Put No Data Found in the Error Message Line. 

Click OK to continue then click Finish.  When Prompted to edit, select No.

4.        Enable the component and restart the ECM server.

Creating the Token:

We will need a Workflow for our example.  In the ECM interface, go to Admin  Applets and launch Workflow Admin.  Create a new Criteria Workflow.

Once this is created, we are ready to create the Token:

1.           From the workflow menu, select Options, Token, and then click on Add.  Enter the Token Name as wk_example_token and a Description of Workflow Example Token.

2.       On the same screen, put has the following code into the Users box: <$wfAddUser(wfGet("xuserlist"), “user”)$>   

Click Ok and then Close.

To keep the example simple, we’ll create a single workflow step that uses the newly created Token to insert users who have the Role admin.

1.       With your workflow highlighted in the left hand side of the window, click Add on the right.  In the new window, put Example into the Name and Description fields.  Leave Users can review the current revision selected.  Click on Add Token and select the token you just created.

2.       Click on the Events tab.  Select the Custom Tab and click the Custom Script Expression check box.  Enter the following code: 

<$getViewValuesResultSet("docAuthors","","")$><!-- this code retreives all the known users-->

<$xuserlist=""$> <!-- this establishes the xuserlist variable with no value assigned to it-->

<$xcount=0$> <!-- it is typical to use a loop counter when trying to values and to control the looping -->

       <$loop SchemaData$> <!-- this begins the looping of the known users -->

                             <$executeService("find_user")$> <!-- this calls the service created for this example,
                                                                                                the Schemadata loop automatically assigned the parameter of dName which this service uses -->

                                           <$loop NameLoop$> <!-- this starts the loop of results from the query results in the find_user service -->

                                                          <$if strIndexOf(dAttributeName,"admin") >= 0  $> <!-- this checks for the result to see if the Role admin is there -->

                                                                        <$if xcount < 1$>  <!-- checks to see if this is the first time through the loop -->
                                                                                      <$xuserlist=dName$> <!-- assigns the variable xuserlist with the userID which has admin Role -->

                                                                        <$else$> <!-- test to see if there are more user to loop through -->

                                                                                      <$xtempuserlist=xuserlist$> <!-- creates a temp holding for all the users found so far -->

                                                                                      <$xuserlist="" & xtempuserlist & " , " & dName$> <!-- add the next user to xuserlist with a , seperator -->

                                                                        <$endif$> <!-- closes the test -->

                                                                        <$xcount = xcount + 1$> <!-- increments the loop count -->





<$wfSet("xuserlist",xuserlist)$>  <!-- This applies the users to the token-->

Click OK two times and enable the workflow.

3.       Check in a document matching your workflow criteria to test the workflow.
4.       Go to Workflow Assignments to ensure the document is in the que.

5.       From the Actions left-hand icon, click on Workflow Info.  You should see all the users that matched the criteria:


  1. I agree with your thoughts!!! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs.Best Java Training in Chennai | JAVATraining Institutes in Chennai

  2. Showbox is one of the best apps among all the others which provide streaming of movies and tv shows.
    The best part is, it is absolutely free for everyone and it also provides multiple resolutions of the videos.
    You can also watch the videos even when you are offline
    If you face any kind of trouble during movies downloading and you want to see latest movies in HD format then you need an app like Showbox.
    Nowadays this app is getting much popular because of its attractive and trendy
    ShowBox for PC

  3. This article provides the information about Java its key features and scope for java professionals. This information is really helpful me to know more about Java programming language. Java Training in Chennai | Java Training | Java Course in Chennai

  4. This comment has been removed by the author.

  5. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Best Hadoop Training Institute In chennai

  6. Nice article Thanks for sharing this article Wonderful information from this website Thanks !!!

    Embedded system training in chennai | PLC training institute in chennai

  7. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.AWS Training in chennai

  8. The article you have shared here very good. This is really interesting information for me. Thanks for sharing!
    shell shockers

  9. من أجل التخلص من البقع وتنظيف الأثاث للعودة إلى الطبيعة ، ستحتاج إلى أدوات ومنظفات خاصة ، بالإضافة إلى يد عاملة مدربة تدريباً جيداً لمساعدتك في القيام بهذا العمل الشاق ، الذي تقوم به Damam City Cleaning شركة دمياط ومختم للتنظيف تقومان بكل العمل الشاق.
    شركة النجوم لخدمات التنظيف
    شركة تنظيف فلل بالرياض
    شركة عزل خزانات بالرياض
    شركة جلي بلاط بالرياض

  10. This comment has been removed by the author.

  11. good..I would like to thank you for sharing this valuable information
    big data training in chennai

  12. awesome blog.

  13. Very interesting information blog post, my favorite this post, thanks a lot for these amazing content.
    Assignment Help
    Online Assignment Help

  14. Whereas, if trees or palms are from the affected areas, a trench is made about 50 cm from the area of ​​infection and pumped with a termite repellent with insecticides that do not have any effect on the fertility of agricultural land.
    شركة مكافحة النمل الابيض
    شركة مكافحة النمل الابيض بالطائف
    شركة مكافحة حشرات بالطائف
    شركة رش مبيدات بالطائف

  15. Thanks Admin For sharing this massive info with us. it seems you have put more effort to write this blog , I gained more knowledge from your blog. Keep Doing..
    Regards, thanks a lot guys
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai