Posts filed under 'LiveCycle ES'
In my quest to use XPath functions & expressions more efficiently in LiveCycle I managed to achieve ‘conditional set value’ yesterday.
Example scenarios:
- Add some text to email body if some condition is true/false.
- Add some text into T&Cs if certain product is selected.
- In a generic/single Email or Set Value step you need to construct a big block of text. eg. Offer letter with certain paragraphs based on few conditions.
Approach 1: The usual way (or one of the usual ways):
An orchestration in Workbench with few setValue steps and few conditional routes to add/append the desired text to existing text.
And these steps need to be in certain order.
Approach 2: The XPath trick
I used substring() and number() function with pure XPath expression to construct conditional set value. See the usage below.
Example:
Consider a requirement in which you wish to send an email with few extra lines added to it if product A is ordered. And if contract term is 12 months then we need to add another T&C statement in the email body.
Let’s implement that with both approaches…
Approach 1: Few set value step and routing conditions to set process variables that get used in email body.
Process Diagram:

Set Value - Route condition approach
Email body:
Dear Provisioning Team,
Please send the below details to John.
System:{$ /process_data/@System $}
Agent Name:{$ /process_data/@Agentname $}
Product ordered: {$ /process_data/@Product $}
{$ /process_data/@ProductAConfigurationDetails $}
Terms and Conditions:
blah blah blah from Legal
adf
adf
{$ /process_data/@TCFor12MonthsContract$}
blah
blah
regards,
BOH Team
Approach 2: Conditional set value with XPath
Process diagram:

Email Body
Dear Provisioning Team,
Please send the below details to John.
System:{$ /process_data/@System $}
Agent Name:{$ /process_data/@Agentname $}
Product ordered: {$ /process_data/@Product $}
{$ substring(‘This is where the actual text gets put about the product configuration’,
50000000 * (number(/process_data/@Product !=’Product A’))
) $}
Terms and Conditions:
blah blah blah from Legal
adf
adf
{$ substring(’12 Months T&C content is written here or can be xpath expression’,
50000000 * (number(/process_data/@ContractLength !=’12′))
) $}
blah
blah
regards,
BOH Team
Explanation:
- The above expression marked in blue puts the text in email body if the condition at the end of it fulfills.
- By moving this logic into the email step itself I could clean up the process design significantly. I believe that LC is too good to do data transformation but common…few set value and few conditional routes for a simple text insertion?? I reckon the XPath trick gives much more cleaner approach to solve this.
- First thing to notice in the expression is the use of a large number 50000000 . This is used to return blank substring value if the expression is false. Please adjust if your input text can be larger than this.
- Second thing to notice is the use of comparison operator. I wanted to have 0 (zero) value for substring start value if condition is true. Boolean true is 1 so I’m using opposite operator. Eg. if(product=”Product A”) is represented as product!=”Product A”
As this is an XPath based expression we can use it in any LC component. I tried implementing if-else clause as well but that didn’t turn out well.
If you managed to read through this much then I’m sure you would love to see the undocumented ‘and’ ‘or’ keyword usage in XPath expression. I found that while experimenting and it’s an instant hit among few of my fellow LC users. It can be found here..
Let me know if you find this useful!!!!
November 27th, 2009
I was experimenting with xpath expression and found that the ‘and’ and ‘or’ works perfectly as the logical operators.
I’m perosnally so happy to see them working. In few cases it was too hard to configure the conditional routes with just OR/AND joint.
I’ve attached an example to demonstrate a simple usage of ‘and’-'or’ logical operators. This is the condition that I’ve put in the example.
(normalize-space(/process_data/@Input_Value1)=’555′ or normalize-space(/process_data/@Input_Value1)=’666′) and (normalize-space(/process_data/@Input_Value2)=’777′)
I believe that this is going to make workflow design so much cleaner. Instead of nested conditional routes and 4-5 decision points or set value steps we would be able to do lot more things in few steps now.
I think this is an XPath Explorer feature so is not limited to just route conditions. All of the places where XPath expression is evaluated should be able use these.
Hope this helps to you too!!!
July 13th, 2009
Hi All,
I was suppose to post easy techniques on how to pre-populate forms via LiveCycle’s Render service but unfortunately it is taking longer than what I expected. This is the story so far… Please comment if you are aware of this and enlighten me around the changed behavior.
Background:
I used the customized render service till LC 8.0.1 SP2 and what we get in dataDoc variable of the Render service is xdp data which had the whole form specific XML structure. But I’m finding that in LiveCycle 8.2 SP2 the dataDoc contains the xdp data but ONLY the Root element of form data is present.
The issue: This results in stalled operations (exception) as the elements that I want to populate does not exist.
The strange thing:
The most strange thing that I have seen is related to where the ‘caller’ orchestration was developed. So if your orchestration which has xfaForm variable was created on LC 8.0.1 then the dataDoc variable will have the xdp data with the whole and empty form data section in it. BUT….. if you touch that variable or re-create that xfaForm variable on LC 8.2 then you’ll start getting the blank form xml section in xdp data (of dataDoc) variable of render service.
Please let me know if anyone has seen this before and knows if this was intentional in LC 8.2 or it is a reported/unreported bug.
stay tuned for the pre-population.. I’ve decided to post a series of two articles to discuss the strategy that I think can work nicely.
June 10th, 2009
This is really exciting!! I knew that this can be done in LiveCycle 7 but never tried it till now in LiveCycle ES. Ok.. let me describe what it is.
What it is?
I found out that we can add styling to the Task Instructions that apear in Workspace. This means that we can have Red font, Bold statuses/instructions based on the task description that we put in Assign Task step of the orchestration.
Why you need it?
Let’s say for example, A Task is deadlined and you wish to put task status/something else in Instructions field which can stand out form the rest of the text. Having something like ‘Deadlined’ status in red with other instructions can be a BIG step forward for someone who works on workspace interface everyday.
I’ve also noticed that the Task Instructions field on TaskManagerEndpoint also ‘likes’ the styling. This means that the Cards or Grid view of Start Process section will also show pretty colors and styling if needed.
Let me show you what I could do with styling in Task Instructions.
Snapshots 1: To-Do list view of a user with styling on Task Instructions (configured in Task Instructions of Assign Task operation)

ToDo Screen with Styling
Snapshot 2: Card view with styling on Task Instructions (configured at Task Manager Endpoint page in adminui)

StartProcess view with Styling
Styling examples:
Style used in Snapshot 1:
<font color=”#FF0000″><b>Deadlined.</b></font> {$/process_data/@taskInstructionsString$}
Style used in Snapshot 2:
<font color=”#FF0000″><b>Leave Application</b></font> <font color=”#9932CC”><b><i>Test</i></b></font> Desc
Tip:
- As the Workspace is a flex application I decided to try the Hex code for the font colors and it did work nicely.
- It is a good idea to show some metadata in task instructions, so user can find out the Task without opening it. Imaging what would happen if you have to find John Smith’s application by opening Task’s one after another. I would put applicant name and/or some other identifier in Task Instruction so it is easy to find!!
- I have a Status variable in my process and I’m applying style to that only so the remaining text in Task Instruction is kept in black. I think this is ‘good enough’ to indicate what’s the status rather than having too much red/orange colors in that view.
Misc: This is just a small example of styling. I don’t know what else will work or will not work but I think we can do really cool things with this much to help out the user who work on Workspace everyday. I’m pretty sure that I’ll see few smiling faces in my next Demo & Deployment of what I’m currently working on.
May 25th, 2009
This post describes a technique to set rich text content into a Textfield of a form that was designed in LiveCycle Designer ES. Thanks to Paul Guerette who helped me out to understand this few months back.
There can be two scenarios in which you might want to set content into a rich text supported Textfield.
- User types the rich text content into a text field and you wish to copy that to another Textfield.
- LiveCycle ES server/some other way you wish to set rich text content into a form field. (Form pre-population scenario)
Where is rich text data in a text field?
When user types plain text in a pure Textfield (field format: Plain Text Only) then the data is set/get from rawValue property. BUT if the Textfield is having Rich Text as the field format then the data is store at .value.exData
How to check what the rich text data look like under the covers?
I use email submit button on a simplest form to see the XML that gets created for submission.
If you wish to do this then:
- Create a simple dynamic PDF form and put a text field with Rich Text format set to it.
- Drop a Submit button and put mailto:someone@abc.com as submit URL
- Open this sample form in Preview mode type some text with rich-text formatting (Bold, Italics etc)
- Hit the email submit button you would be able to see the exData content as the child element of your Textfield.
Now let’s look at above mentioned two scenarios in details:
Scenario 1: User types the rich text into a field and we want to copy that to another field.
How to copy rich text from one Textfield to another Text field?
Steps:
- Get the content out of first text field by this java script
txtInputTextArea.value.exData.saveXML();
- Set that value in the destination Textfield’s exData property.
txtOutput1.value.exData.loadXML(userEnteredRichText,1,1);
Scenario 2: We need to pre-populate the form and the rich text data is not typed in (received from web service call or out of database etc..)
How to set rich text data into a Textfield?
Steps:
- Receive the markup data. eg. Hi <b>John</b>,<br/>Please find application-<i>111</i> details below.
- Have exData ‘envelope’ ready in your form and inject the received markup data. (You may have to replace < > values with < , > if received data is having that)
- set the ‘envelope’ + data into Textfield’s exData element.
txtOutput1.value.exData.loadXML(cleanedValue,1,1);
Note:
What is ‘envelope’ which is mentioned in this example/blog entry?
I mentioned ‘envelope’ in Scenario 2 explanation which is something that allows me to insert markup data in a form that Textfield is expecting for rich text support.
What I have done in my sample (attached/linked below) is to have another Textfield storing this exData section with namespaces in it. This is what gets generated behind the scenes when user types the rich text content in Textfield.
I have a ‘ccc’ string in this whole block where the actual data(markup data) is needed for the Textfield to show that correctly.
So in my form script I use this ‘envelop’ to store the exData block and then via script I replace the ‘ccc’ value with the markup data that I receive. And then I use this merged xml block to set to the Textfield’s exData property.
Download Sample implementation:
Use this PDF file that has both of these scenarios implemented as a sample.
Richtext in Textfield Sample
May 20th, 2009
I recently noticed that LiveCycle workspace URL has few parameters which would be really helpful in LC projects.
The format to livecycle workspace URL is something like this:
http://[server name]:[port]/workspace?[parm]=[value]
- [server name]is the name of the LiveCycle ES server
- [port] is the server port used for LiveCycle ES
- [parm] is the name of the parameter
- [value] is the value of the parameter
Three possible types of URL that we can use with the help of URL parameters are:
- URL pointing to a Task (Work item in To-Do list)
- http://localhost:8080/workspace?taskId=100
- URL to open workspace with any of the three tabs of workspace -
- http://localhost:8080/workspace?startPage=startProcess
- http://localhost:8080/workspace?startPage=toDo
- http://localhost:8080/workspace?startPage=tracking
- URL to open a form from Start Process page to kick off a new process -
- http://localhost:8080/workspace?startEndpoint=[service name].[endpoint name]
The last one is in fact the most interesting one as you can publish the links on company portal and that will straight away open the relevant form so everyone wouldn’t have to find the form in Start Process page.
More details are at LiveDocs
April 23rd, 2009