Wednesday, 7 November 2018

Schedule reports like a Boss

Boss: I want the report of user created for each department for the previous week every Monday morning at 6:00 AM

Developer: Okay Boss. I will create a report for you. You can run it every Monday morning.

Boss: Okay,but I don't want to run it. It will be good that when I log in Monday morning the report is emailed to me and I can review it with a cup of coffee..

Developer : oooohkk. 


So where do we start?!!
1) Simple LiveReport to fetch the users created in the last week
select 
K1.Name as Username, 
K2.Name as Department, 
K1.MailAddress,
CreateDate  
from DTree , KUaf K1, KUaf K2
where SubType = 142 
and DataID = K1.ID
and K1.GroupId = K2.ID
and K1.Deleted = 0
and CreateDate > %1

and CreateDate <= %2


Where %1 and %2 are set as following parameters
%1 - Last Week Start
%2 - Last Week End


2) Create webreport with source as LiveReport and make a neat table 
[/* Title: Blank Reportview */]
<title>User created during the week : %1 and %2</title>
<table>
<tr>
<th> Name </th>
<th> Department </th>
<th> Email Id </th>
<th> Create Date </th>
</tr>
[LL_WEBREPORT_STARTROW /]
<tr>
<td> [LL_REPTAG=UserName DECODE:'?':'' /] </td>
<td> [LL_REPTAG=Department DECODE:'?':'' /] </td>
<td> [LL_REPTAG=Mailaddress DECODE:'?':'' /] </td>
<td> [LL_REPTAG=CreateDate DECODE:'?':'' /] </td>
</tr>

[LL_WEBREPORT_ENDROW /]

</table>


3) Schedule the report
Go to destination tab of the WebReport and select Email as destination.
Select Set scheduled and then make it available for monday and dont forget to click on the forever checkbox :)




4) Close your laptop and go home.



Sunday, 8 December 2013

One custom view... Many Places....

Recently, I worked on a issue with custom view which caused a bit of pain to fix. I would like to share it with you guys...

A custom view was applied to a project template and all the project created from it had the same custom view copy in it. Now I wanted to fix a html section in this custom view which is easy. But what about all the project created from the project template which contains the copy of the old html file. I need to find them and add a version to the custom view.....not cool at all...

Anyways, to avoid such scenario in future a simple solution can be put into place.

1. Create a Folder and create the custom view here.
2. Give Public Access over the custom view (So that no permission issue)
3. Create shortcut in the project template pointing to the custom view.
4. Rename the customview shortcut in the project template as customview.html (This is important) and it good to hide the shortcut.

Now all the project created from the template will have the shortcut instead of new copy of custom view (we just saved a small amount of space too by avoiding creation of new copies). Also, any change to the custom view can be easily done by doing changes in just one place.

So, what do you think.....A neat solution in place right???



Thursday, 28 November 2013

Moving Livelink Workflows map from one environment to another

Moving workflow from DEV to QA and from QA to PROD can be easily achieved and is quite fast too.

Usually, you can export the map and import it to another environment but if your workflow has form then it becomes a bit tricky, right? Yes, because you can export and import your form. And if you are creating the form again then you need to maintain the attribute ID and name of each attribute so that when you add the form to the workflow map the data is filled in all the step and if you have customization nothing breaks.

Here is how I like things to be done.

1. Create a project from the source environment
2. Move your workflow, form(s), category(ies) to the project.
3. Click on the function menu and create select "Make Template". Provide the target location and the new project is done.
4. Click on the template function menu and export the template as XML.
5. In target environment, go to Administrator pages -> Item Template Volume
6. Add Project Template and select the XML file created in Step (4)
7. Create project using the project template.

All your form, workflow and category are now in your next environment in that project. A few more steps and we are ready to do.
1. If your form has table, click on Manage Relational Table and create the table. If there were any HTML\PDF\WR Power view you can add the views to the form template.
2. Go to Workflow map enable Attachment and Form word packages (same as your last environment)
3. If you have form then go to Map-> Form and add the form template with the same name as in the previous environment. Voila!!! all you form step now will have the filled data. 
4. If you have any Item Handler step then go to those step and add the category back.

And its done...Go ahead and test...

Happy workflow development






Monday, 24 September 2012

Clean way to restart your livelink services

Sometimes you would like to restart your livelink services for adding patches, upgrading modules or just like that. The best practice to do a restart is listed below.

  1. First we Log-in to server where the web server is installed (In this case : IIS)
  2. We take Livelink server out of load balanced pool by changing the HTTP port (Lets put  a no. like 9191 which is not used)
  3. We then check if there are any requests pending with the Livelink server we want to restart.
    So let check the thread status - http://IPAddress:port/cgi/livelink.exe?func=admin.threadstatus
    If there is something running, we wait till those processes are over and then proceed further
  4. Apply the patch or do the module upgrade that you want and restart the server.
  5. Now we put the Livelink server back into load balancer by changing the port back to original. (i.e. 80).
  6. Repeat the above for all servers.

Thursday, 22 March 2012

How do I create my own Agent in Livelink


Did you ever wonder who sends all those email notification when any action is performed in Livelink  about which you would like to get notified or do those workflow steps that no other users want to perform....Think Think...


The answer is simple.. 
There are some agent quietly running in background, some of which are responsible to send those notification emails or doing those workflow steps :)




Now, can we write our own Livelink Agent? - Yes, we can and it quite easy too..


And those easy steps are

  1. Orphan the node LLAgent:Agent node in your custom module
  2. Create a child node and give it a fancy name (say myFirstAgent)
  3. Give it a Id. Override the fAgentID (This id goes into your agentschedule table and should be a value above 9999)
  4. Enable it my setting fEnabled to true
  5. And put the code that you want to run in the Execute method.
  6. Do entry in AgentSchedule table with Enable set to true and other details. 
You also make a custom admin page to set the bitmask and enter the values in the agentschedule table. According to the bitmask the agent will run on a periodic basis.

For testing purpose, you can run the agent using a simple URL http://hostname/livelink/livelink.exe?func=agent.runagent&agent_list={'id1','id2'}

Just make sure that RunWithoutLogin is set to true in your ini file before trying the above URL.


Hope I made sense :)



Vote of thanks to Siva Thanneru, friend and ex-team mate who wrote the first agent for my project :)

Thursday, 1 March 2012

Replacement Tags are really useful when we are working Livelink Forms and Workflows. We can use replacement tag to display logged-in user information in a form or to get attribute and form values or use it for workflow related values like work id, workflow title, etc.

Lets start with the Form Replacement Tag :

I want to display information about the logged in user when I open my form. Lets see how we can achieve it.

An sample Form Template is shown below. I want the username and the email id to pre-populate when I open the form.


My first step is I export my template in HTML format using Export As HTML and edit the value attribute of my input tags (as shown in Fig 2). I can add this edited HTML as an HTML View to the template and create forms to store data in Livelink or initiate workflows.


When I open my form. My name and my email Id is pre-populated from the KUAF Table.



____________________________________________________________________________

Dynamic Replacement Tags : Let take the example and understand the tags. When I click Apply button for the form shown above I initiate a workflow with the name Workflow ID -<Username>_<Office Location>_<Initaition Date>

We can do this using very simple replacement tags as the Title in the General tab of Workflow Settings. I use the following tags to meet my requirements
  • <WorkID /> to show the unique ID associated to the workflow
  • <DataType_1_4_1_Username /> to get the name from the form
  • <DataType_1_4_1_Office Location /> to specify the Office Location specified by the user in the form.
  • <InitiatedDate /> to shows the date




Some ready to use, self-explanatory tags are 

  • <Initiator /> 
  • <InitiatedDate />
  • <WorkflowTitle />  
  • <ParentTitle />    
  • <SubInitiatedDate />   
  • <WorkID />    
  • <InitiatorMail />  

To use Form Attributes, we can use the the tag <DataType_1_4_FormId_AttrName />


To get the form Id, go the the Forms tab in workflow setting page and click on Edit. The URL in the address bar has the unique form id associated to a particular form eg: http://livelink/livelink/livelink.exe?func=formwfpaint.FormEdit&MapID=1234567&FormID=1&nextURL=...




To get workflow attribute is easy just use the tag <DataType_1_3_AttrName /> 


We can use these tags to define step names, to give instructions, or to/body field of a process step. 

An useful link from KC.


__________________________________________________________________________

If u have livelink XML Workflow Extension module installed then you get lot placeholder to do a lot of things. Few useful tags are [title] that returns the workflow title, [mapid] unique id for the workflow instance. The list of placeholder available with this module is quite long and exhaustive. 
Best place to get the placeholder is the Livelink Help section 'XML Workflow Extensions'

To get workflow attribute, we use a placeholder [attribute=<attribute>:<attribute field>]  and for form attribute a placeholder [form=<formname>:<set>:<attribute>]

Learning by example




We have a form template with attributes called username, email id, office location. We also have a Set added to the template which has three attributes called House No, Street Name and ZIP Code.



This form template is added to the workflow with the name Initiation Form.









An sample Email step body field may look like this