You are viewing limited content. For full access, please sign in.

Question

Question

HOW TO: Launch a Forms Business Process via Workflow

asked on May 18, 2015 Show version history

I've seen in many different posts requests for instructions on how to initiated a Forms business process from within a workflow and pass parameters. The responses have been to use HTTP requests, it's complicated, and future versions of Forms/Workflow will support this directly. These are all TRUE. ***Update - Current versions of Workflow and Forms have inbuilt activities to handle this*

 

Here are by step instructions on one way of doing it for Forms 9.2.1 and WF 9.2. Of note, this is not guaranteed to work in future versions of the Forms product and therefore is intended as educational or workaround use cases.

 

Background:

I wanted users to be able to right click on a document within Laserfiche and start a Business Process on an entry which would launch a Forms Business process instead of only a Workflow in order to take advantage of the user experience options in Forms. For this example, we'll pass one parameter, entryID into the forms process via the last WF activity.

Overview: We're going to setup 4 activities in WF. First to login to Forms, then to request the business process, grab a value from the response, then submit our form and initiate the business process.

Setup:

A.) If your forms process requires authentication in order to start, setup a Forms Account which has rights to start this process. For our example, we'll use Test as a Laserfiche Username and tester as the password.

B.) Setup a Webservice in workflow via Manage Webservices.

  1. Type: Custom
  2. URL: http://machinename (of Forms Application)
  3. Use Default Authentication
  4. Run activities that use this web service as a task
  5. Accept invalid certificates

 

Workflow Steps:

1: HTTP Post Activity

  • Web Service is the one setup above
  • URI: /Forms/Account/Login?returnUrl=%2FForms%2F   (This assumes the full path to your Forms login page is http://machinename/Forms)
  • Method: Post
  • Form Data
    • Username - Test
    • Password - tester
  • Click on the gear box to configure advanced options
  • Check - Follow redirects

2. HTTP Web Request Activity

  • Web Service - Same as above
  • URI: {/Forms/jqm1L} This is the URL to your forms process when clicking on it from the green start icon from the Manage tab in Forms.  jqm1L is my forms URL.
  • Method: Get
  • Click on the gear box to set advanced properties
  • Request Cookies - Select, Set to the Request Cookies of the Login to Forms activity
  • Check Follow Redirects
  • Check Output new cookies container

3. Pattern Matching Activity

  • New Token - Name it uqid
  • Input - Set to the token "Content" from the Activity configured above.
  • Pattern: (?:name="uqid"  value=")([^"]*)">
  • Check case sensitive
  • If multiple matches are found, return: First match only

4. HTTP Web Request Activity

  • Web Service - Same as all the others
  • URI: /Forms/Form/Submit
  • Method: Post
  • Content Type: application/x-www-form-urlencoded
  • Content Body: Field1=%(Entry ID)&action=Submit&formid=31&IsLocked=False&uqid=%(FindUQID_uqid)&routingResumeId=&stepid=1
    • This is the trickiest part so I'll break it down. (*This is all one line)
    • Field1 is the name of the input field given by Forms itself, not by you in the editor tools. It follows the schematic of if it's labeled Q1, then Field1 is what we want. If you want to set the parameter for the input field in Q4, then Field4, is what we want. In this case, I'm using the global token of entry ID to pass the entry ID of the workflow starting entry.
    • Action = This is the name of the Submission button at the bottom of the form configured from the process modeler. If it displays something other than Submit, you'll have to change it to that name.
    • FormID = This is the FORMS ID, not the Business Process ID in forms. To find this, edit the starting form in the Forms editor and notice the URL. The number at the end is the FormID. http://machinename/Forms/design/layout/31
    • uqid = pass it the token from the pattern matching activity, this is a unique id generated at the time of display of the submission form
    • Leave isLocked to false, routingResumeID to null, this deals with the saving, resuming later feature I believe
    • Leave stepID to 1.
  • Click advanced Tab
  • For request cookies, select the cookies from the previous HTTP Request activity.
  • Check Follow redirects

Done!

 

 

One can test the requests at each step but note if a login is required prior to starting the business process the last two activities will not work.  So make it public first, make sure everything works, then make it restricted and test again by launching the whole Workflow.

 

Lastly, be mindful of your workflow security as this setup has the Forms account credentials in clear text within the workflow definition. Anyone who has the right to download and view the workflow activities will also have access to these credentials.

 

Cheers,

Carl

20 0

Answer

SELECTED ANSWER
replied on May 18, 2015

Thank you for this detailed post Carl, I don't have much to add to it except that you can skip the login step if you have a public form and it wouldn't hurt to log out as well since some minor resource cleanup does happen, and its always better to do that explicitly. You would do a HTTP Request activity that does GET Forms/Account/Logoff (remember to hook up your cookies).  

I do want to quote you on this part for emphasis:

 

Here are by step instructions on one way of doing it for Forms 9.2.1 and WF 9.2. Of note, this is not guaranteed to work in future versions of the Forms product and therefore is intended as educational or workaround use cases.

 

And this is the very reasons that the Workflow team's official response to this problem still is:

... future versions of Forms/Workflow will support this directly.

 

I would also like to say that the future version is very close to being the current version. Here's a preview from my designer's toolbox.

 

7 0

Replies

replied on November 4, 2016

I would like this or similar functionality.  We aren't upgrading to 10 anytime soon.  

Do you know if you can run Laserfiche 10 alongside older versions of Laserfiche (9.2.1 of Forms, Repository, etc)?

1 0
replied on November 7, 2016

Hi Joe,

 

I believe these features are independent of repository server however other areas may not work. I do not believe Forms 9.2 and Workflow 10 would be compatible for launching Forms processes from Workflow. You would need both Forms and Workflow to be at 10.

 

However, I am uncertain and will leave this question for the engineers.

 

Cheers,

Carl

 

 

1 0
replied on November 7, 2016

Carl is right, you can keep the Laserfiche Server at 9.2, but both Forms and Workflow have to be on version 10.

2 0
replied on May 18, 2015

Nicely done Carl. I think this closes off roughly six open threads at the moment! Thanks for the post :)

0 0
replied on May 18, 2015

Carl, this is brilliant. I am really curious how you figured this out?

0 0
replied on May 18, 2015 Show version history

Thanks guys! Was ecstatic to get it working so had to share since I've gleaned so much from everyone! 

 

Gareth-

 I used Fiddler on my local machine to watch the HTTP activity occurring and manually mimic'ed what I wanted Workflow to do.  (which I think was suggested Empower course for debugging).

 

Fiddler allows you to rethrow HTTP requests and modify the values in between so I'd tweak, test, tweak and then watch what workflow was throwing to see if it matched what it needed to be once I got it to mimic right in Fiddler.

 

All,

Using test requests from the designer on the last activity will result in a "Laserfiche Forms encountered an error" if the uqid provided and .net session cookie are not valid. Use fiddler for the cookie and view source for the uqid. Otherwise it's probably easiest to just fire the whole workflow.

 

I also configured request headers, not sure if they are necessary but here's what I used below.

For the second activity, Request BP

Accept: text/html, application/xhtml+xml, */*
DNT: 1
Accept-Language: en-US

For the 4th activity, Initiate BP

Accept: text/html, application/xhtml+xml, */*
Referer: http://machinename/Forms/jqm1L
Accept-Language: en-US
DNT: 1
Connection: Keep-Alive
Pragma: no-cache

 

This is my first time using the HTTP activities (hence my excitement!) so feel free to offer improvements or suggestions!

 

Big thanks to the workflow team for your focus on making awesome modular activities for us to use in imaginative ways. The simple yet extremely powerful HTTP activities are amazing to chain together now that I understand them more.

0 0
replied on May 18, 2015

Chaining them together is exactly what the cookie container property is for, so I'm glad its getting used. 

I do want to caution that due to HTTP session timeouts, don't chain them together and then put a delay, wait condition, or something that might retry with an entry locked in the middle of your chain. 

1 0
replied on May 18, 2015

Thanks Ed!

0 0
replied on June 24, 2015 Show version history

I'm trying to configure this right now but I can't seem to get it to work. The second web request activity always gets redirected to the login page. Which is pretty strange since it is using the request cookies from the login activity, which I confirmed works fine.

Because of this, it can't find the uqid, and the third activity fails.

The way I confirm that the login is working is by having workflow email me the response from the login activity, then copying it to a text file, saving it as .html and opening it in a web browser. It's the Forms Inbox. But the Request BP activity hits the login page regardless.

Carl, have you run into this in your development process?

EDIT: I figured it out. Also had to check the "output new cookie container" checkbox in the login activity. :)

By the way, I also had to use another pattern. The one you provided worked during testing (i.e. in the token test box in the PM activity), but kept failing when I actually ran the workflow. The pattern I used was: 

value="(\w*-\w*-\w*-\w*-\w*-)"

0 0
replied on June 25, 2015 Show version history

Hi Ege,

 

Glad you got it working and thanks for posting your workarounds!

 

I verified my process and confirmed it works without the changes you mentioned. I do have [Output new cookie container] on the Request BP activity but not the Login. My pattern matching is still as pictured aboved with: (?:name="uqid"  value=")([^"]*)">

 

The only issue I've ran into so far is if the workflow runs on 50 entries at once, the Forms application will reject some of them. Probably due to IIS settings or application settings due to the rapid requests. I'll be building some more validations and confirmations within the workflow to ensure successful login, request, and so on.

 

Very interesting, thanks for posting.

 

 

 

0 0
replied on June 25, 2015

I should be the one thanking you. Using the information you gave, I successfully integrated Laserfiche with QuickBooks. It's an accounts receivable process where Workflow is taking invoice data from QB and populating a form with it. It's even able to populate a table on the form with the invoice line items! I'm going to do a write-up on it at some point.

Thanks again!

1 0
replied on July 2, 2015

Hey Ege,

Let me know if you'd like to be featured on the Solution Exchange ;)

 

0 0
replied on November 2, 2015

Hey Carl,

Have you found out why the Forms application rejects some of them?

0 0
replied on November 3, 2015 Show version history

No not exactly. My suspicion remains in the login module or session settings of the forms application. It didn't like receiving the rapid requests to initialize a session and rejected some of them.

 

For handling multiple form submissions I now establish one session, loop through my form submissions, and then logout.

 

This approach has worked without any rejections.

 

0 0
replied on July 2, 2015

Product roadmap suggests this will be out in Version 10, towards the end of this year.

0 0
replied on November 7, 2016

Was these feature included in version 10 as planned?

0 0
replied on November 7, 2016

Ryland,

 

Yes they were. Here are the activities within Workflow 10.

 

Cheers,

Carl

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.