NexJ Logo

Process Management resources

In this lesson, you will be familiarized with Process Management forms and syntax. We begin with links to conceptual overviews.

The Process Management (CPM) URL

You can access a sample CPM process in your training environment at http://localhost:7080/training/ui/bp?mode=bind

You can inspect the functionality here, such as multiple ordered pages of input; conditional visibility; validation; integration with the business model to save on data entry, requiredness, and completion status.

Review Functional/Admin documentation

First let's start with getting to know what process management's capabilities are. The best way to do that is to look at the end user and administrator documentation. Spend some time reviewing "Business Processes" and "Managing Process Management forms" in the end user documentation. These are lengthy documents and will take some time.

After reading these documents and working through some of the administrative capabilities, you should know that the bp admin workspace is available at <Application Root URL>/nexj/ui/bp-admin.

Give your user administrative rights

Before we can access the bp-admin workspace, we need to give our "wm1" user sufficient privileges. Open the Admin Console using an "incognito" browser and log in as the nexjsa user. In Google Chrome, click the Customize and control Google Chrome buttonin the top right, and select the New incognito window menu option.

 

Then navigate to http://localhost:7080/training/Admin.html and log in as user: nexjsa, password: nexj. Navigate to the User page, and in the Users tab, filter to your wm1 user. Next, ensure that wm1 has the Business Process Admin role in the Privilege Groups subtab. Then in the Privilege Groups subtab select the Business Process Admin privilege group, and using the Privileges picker, select all of the privileges that start with "bp:".

Save your work and exit the Admin Console.

The Process Management Admin URL

You should be able to access the bp-admin workspace now at http://localhost:7080/training/ui/bp-admin.

Review the Process Management developer documentation

Process management definitions are stored as scripts. They are stored in the library section of the resources layer of the Navigator. They are just source code so they work well with source code control systems, large development teams, and versioning.

Review the following information on developing process management forms. Start in the Process Management section and review developing process management forms and the document outlining the process management controls.

Try out some scripts

The templates workspace is a great place to see the capabilities of the process script.  It is a domain-specific-language for writing business forms and flows that can be expressed in Scheme or JavaScript. Simply click the Open Code button  on any template row and you can either inspect or edit the script, depending on its state.

Note that to see some of the documentation on the functions used in the scripts, simply open a scratchpad or library file, type bp: and press control-space. The help here works as with all help so you can hover or press "F2" and see the help text.  

For example:


Now let's get some hands-on experience writing scripts. Navigate to the Templates tab which is the second workspace in the bp-admin application. This presents you with a list of all templates in the system. Select the "bind" template and click Copy at the end of the row.

Call your copy "bind_training" and click Create.  In the bind training row, click Edit.

Then click the Open Code button .  You should see the Edit Code screen. This is a great screen for learning about how the scripts work. You can make changes to the script on the left, then click Preview in the top-right to see your changes and try them out in the Preview section.

If you want to try the JavaScript syntax out, simple copy the bindjs template to bindjs_training and edit that file.

Have Developing Process Management forms and Form controls open and handy so you can try out some of the capabilities of the different controls.

Open the editor and try some of the capabilities mentioned in Developing Process Management forms.

Then look through the Form Controls document while editing and try the various properties out for the different control types.

Have fun!

Special topic - Integration

Try the following code out to see how the bp:integration object works. This is a great example.

(bp:page p1
         (: caption "Client On-Boarding")
         (bp:section s1
            (: caption "Client Details - Integration Example")
            (bp:text firstName (: caption "First Name"))
            (bp:text lastName (: caption "Last Name"))
            (bp:integration AMLCheck
               (: caption "Validate AML")
               (: enabled (and (not (null? (@ question firstName))) (not (null? (@ question lastName)))))
               (: event
                  (let ((msg (message (: status 200) (: message "OK"))))
                     (cond
                        ((= (@ question lastName) "Lamont")
                           (msg'body (message (: result #t) (: description "This client is currently not on any known AML sanctioned lists")))
                        )
                        ((and (= (@ question firstName) "Walter") (= (@ question lastName) "White"))
                           (msg'body (message (: result #f) (: description "Unable to on-board this client")))
                        )
                        ((= (@ question lastName) "404")
                           (msg'status 404)
                           (msg'message "ERROR")
                           (msg'body (message (: result #f) (: description "Unable to perform AML at this time")))
                        )
                     )
                     msg
                  )
               )
               (: result
                  (let
                     (
                        (result (if (= ((@ value)'status) 404) #f (((@ value)'body)'result)))
                        (description (((@ value)'body)'description))
                     )
                     (cons result description)
                  )
               )
            )
            (bp:text AMLDescription
               (: enabled #f)
               (: value (((@ question AMLCheck)'body)'description))
            )
            (bp:integration getAccountOptions
               (: caption "Get Client Accounts")
               (: enabled (and (not (null? (@ question firstName))) (not (null? (@ question lastName)))))
               (: event
                  (let ((msg (message (: status 200) (: message "OK"))))
                     (cond
                        ((= (@ question lastName) "Lamont")
                           (msg'body
                              (message
                                 (: result #t)
                                 (: accounts
                                    (collection
                                       (message (: value "LAMONT1") (: caption "LAMONT1"))
                                       (message (: value "LAMONT2") (: caption "LAMONT2"))
                                       (message (: value "LAMONT3") (: caption "LAMONT3"))
                                    )
                                 )
                              )
                           )
                        )
                        ((= (@ question lastName) "Abrams")
                           (msg'body
                              (message
                                 (: result #t)
                                 (: accounts
                                    (collection
                                       (message (: value "ABRAMS1") (: caption "ABRAMS1"))
                                       (message (: value "ABRAMS2") (: caption "ABRAMS2"))
                                    )
                                 )
                              )
                           )
                        )
                        ((and (= (@ question firstName) "Walter") (= (@ question lastName) "White"))
                           (msg'body (message (: result #f) (: accounts (collection))))
                        )
                        ((= (@ question lastName) "404")
                           (msg'status 404)
                           (msg'message "ERROR")
                           (msg'body (message (: result #f) (: accounts (collection))))
                        )
                     )
                     msg
                  )
               )
               (: result
                  (let*
                     (
                        (result (if (= ((@ value)'status) 404) #f (((@ value)'body)'result)))
                        (description
                           (if result
                              (string-append
                                 "Account retrieval successful for client: "
                                 (string-affix (@ question firstName) " " (@ question lastName))
                              )
                              ;else
                              (string-append
                                 "Cannot retrieve accounts for client: "
                                 (string-affix (@ question firstName) " " (@ question lastName))
                              )
                           )
                        )
                     )
                     (cons result description)
                  )
               )
            )
            (bp:radio accounts
               (: caption "Select an account")
               (: options (ifnull (((@ question getAccountOptions)'body)'accounts) (collection)))
            )
         )
      )

If you did the Integration Fundamentals course, try using bp:integration to call the weather service we created and display the temperature based on an address entered by the user.

Enjoy.