I LOST ALL CONTENT WHICH WAS STORED IN COMMUNITIES.OPENTEXT.COM.IF YOU ARE A STARTER READING THIS AND WOULD LIKE TO SEE THE ORIGINAL CONTENT DEPENDING ON TIME I HAVE I CAN SEND YOU SNIPPETS.LEAVE A COMMENT TO SUCH EFFECT.
Getting Old.One of the most productive ways one uses Oscript is to create Event scripts in livelink workflow.
Workflows in livelink are perhaps the most easy ways to impress your clients and a lot of partners and ecosystems are built on top of that.Event scripting is taught or learned by one who has been introduced in livelink.But in a nut shell if you know how to paint a livelink workflow and thought of somethings like,how I wish OT gave me code to do this small thing which I am trying to do in a “kludge”. You may have noticed the “kludge” with how one uses XML WF Extensions ,to get to a document in the attachments area and do something with it.So a XML WFExt map looks very weird there will be a Export step,modify step for anything/ everything you want with it kind of very silly when you look at at the map.Fortunately when I was learning this XMLWfExt was high priced so we did not get to use it,hence we had to do it via event scripting. Once you get hooked into it man are you gonna love it. WR getting to attachments is also another inefficient way to do your stuff but the standard by line is oscript can break your investment.But when anybody wants anything done they would go to OT or Vendors who would you guessed it use Oscript to provide the magic.There is nothing more untruthful than this . Oscript when learned and done the correct way will survive years.To basically make a point I am going to attempt to see if a eventscript I wrote on 9.1 Sp3(circa 2003) can be made to work in 9.7.1(2013).I will even try to make it work in CS10 ,but then I will have to spin up a 2008 VM and so on.
Task At Hand:WF is initiated with a custom title made up of attributes, strings etc. The WF has four forms loaded into them and the template has a label and a field called TITLE My job is to take the title and replace it on the form fields. Seems pretty easy to do.
My template looks like this and I tried not to write code it does not work when initiating the workflow
Ok so as most of developers do I put a break in that script with just a echo statement to start doing my work so that I can see the variables etc. so as most new people will face I get this
and more importantly the debugger my task info is an ERROR.Without which I cannot proceed.I say this after 10 years because now I know how to do this.I did not at that time and so many of you will also go thru this.
So what do you do.After pondering for a while I resignedly said let me put it in another step and tell the user that it is a livelink limitation you will get an extra step in your workflow so click it to run the event script
so here’s my experience when I put the event script on the next step
Now we still have a error but that is actually joyous because we can now start debugging
But look at the TaskInfo variable now it has what we are looking for and trying to debug all the rest of the script
I managed to figure out the rest with echos etc and finished the script
Now HERES WHAT THE UNBELIEVABLE PART WAS .I JUST EXPERIMENTED PUTTING IT BACK TO HOW I WANTED , TO THE START PLACE AND IT WORKED
Since the project was a go I was very overjoyed.Later as I started reading articles by Jeff Lang,a great guy,who incidentally wrote livelink workflow he kind of explained the C++ firing and so on.We are friends and he has helped me and many other people when we got into a bind.I loved a post where he kind of admonished the developers who wrote XMLWFEXT….:(
See his post in 2007 I wish I had asked him in 2003 or learned it the proper way 🙂
In continuation here’s what you will definitely succeed start small,take baby steps and try some of these best practices
- Event scripts can be debugged only if the work is committed in the database,means it has to initiate.What I mean is basically in WWORK the row is available.what looks as a “chicken & egg” situation may only be in development and really not in the real wf operation as I found by trial and error.Nowadays there is the IH step which you can put and assign it as a scheduled time.At the time I was doing this I did not have the liberty of such a step.
- Do not chain event scripts into the start step,milestone that kind it makes debugging difficult.Start to a milestone these are auto done steps.Milestones later in the map should not have problems.
- Do not have many things that a IH will do.Break it into manageable pieces.You will be grateful you did.
A really bad WF map made up of XMLWFEXT,WR,eSIGN etc the reason why the “kludge” is arrived is because of the designer not resorting to event script programming.Nor is the logic very sound.Stay away form those kinds.A business user should understand the wf map that is what the process is designed to support.Whenever I design a map I give the business user a standard swim lane diagram I find in the web.9 times out of 10 the map becomes much better that way.I also encourage my users to paint and change maps so it does not become a specialized livelink job.