Topic
  • 5 replies
  • Latest Post - ‏2013-10-07T23:01:41Z by jdell
jdell
jdell
105 Posts

Pinned topic ITIM: Workflows and relevant data items

‏2013-10-04T04:56:19Z |

Hello,

I have a query regarding my understanding on a usage of relevant data items in ITIM workflows.

 

I'm modifying an operation workflow and I have defined a relevant data item (RDI) called "ownerContainer" of type String.  I set the value of this RDI in the Start node of the workflow.  Further on in the workflow in a script node, I attempt to test the value of the RDI and I have found via logging, that the value of the RDI is not available.

 

This is the code I use in my Start node to set the value of the RDI:

 

thisPerson = new Person(Entity.get().getProperty("owner")[0]);
ownerContainer = thisPerson.getProperty("parent")[0].name;

 

In my script node where I attempt to test the value of the RDI, I have logged the value of "ownerContainer" and the log entry reads:

<LogText><![CDATA[CTGIMO023E The following definition error occurred.

Error: CONTAINER NAME is com.ibm.itim.workflow.script.wrappers.RelevantDataItemWrapper contained object is:

com.ibm.itim.workflow.model.RelevantDataItem@e100e10 ]]></LogText>

 

So it appears that the RDI is not "available" in my script node.

I can get the workflow to run correctly if I repeat the two lines of code from my start node in the script node and set the value of "ownerContainer" again..  Is my understanding of this usage of RDIs all "screwed up"?  Or am I missing something here?

 

Cheers,

John D

Updated on 2013-10-04T05:05:17Z at 2013-10-04T05:05:17Z by jdell
  • mark99
    mark99
    26 Posts

    Re: ITIM: Workflows and relevant data items

    ‏2013-10-04T06:25:30Z  

    Yes you are missing something.

    In each script node a new javascript runtime environment is initialized 

    You have to use the set methode in the start node

    ownerContainer.set(thisPerson.getProperty("parent")[0].name);

     and get methode in the script node

    value=ownerContainer.get();

     

    see http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=%2Fcom.ibm.itim.doc%2Fcpt%2Fcpt_ic_wkflo_javascrpt_extensions_rlvntdta.html

     

     

     

     

  • franzw
    franzw
    396 Posts

    Re: ITIM: Workflows and relevant data items

    ‏2013-10-04T06:33:46Z  

    When you click on the "Properties" button up in the left corner of the workflow designer you will see all the PERSISTENT properties of the workflow.

    These re the ones you read/write in the scripts using the <property>.get()/.set() methods. Be aware that they represents objects - so you have to add them in the right types (e.g. Account/Container/Service) depending on what you need to store.

    So if you need to store something called RDI (property name) in the workflow i the start node you will code something like this :

    myRDI = <code to calculate value of RDI>

    RDI.set(myRDI)

    Then in a late script node you can read it :

    myRDI = RDI.get()

    myAttr = myRDI.getProperty("myAttr")

    ...

    I hope this shows the concept - trying playing around with properties - if you work with workflows this is one of the things you REALLY need to understand.

    HTH

    Regards

    Franz Wolfhagen

  • goonitsupport
    goonitsupport
    117 Posts

    Re: ITIM: Workflows and relevant data items

    ‏2013-10-04T13:56:38Z  

    On a side note putting scripts in the Start node is not always obvious to anyone that has to support the workflows in the future. Consider this advice from S Swann http://www.stephen-swann.co.uk/blog/  - "ITIM Best Practices For Workflow Design"

  • franzw
    franzw
    396 Posts

    Re: ITIM: Workflows and relevant data items

    ‏2013-10-04T14:09:53Z  

    On a side note putting scripts in the Start node is not always obvious to anyone that has to support the workflows in the future. Consider this advice from S Swann http://www.stephen-swann.co.uk/blog/  - "ITIM Best Practices For Workflow Design"

    Totally agree - a very important IMHO when doing workflow and TDI development is to ensure that somebody just looking at the flows should be able to deduct the functionality of the flow.

    So - it is better seen from a TCO point of view to have a set of script nodes with clear naming of what they are doing instead of one script node doing everything - the latter is actual considered "Best Practice" -  but that is due to performance reasons and that should only be a problem in really highload environments. And in that case you better avoid these kind of things totally (write extension/JavaScript extension instead).

    Regards

    Franz Wolfhagen

  • jdell
    jdell
    105 Posts

    Re: ITIM: Workflows and relevant data items

    ‏2013-10-07T23:01:41Z  
    • franzw
    • ‏2013-10-04T14:09:53Z

    Totally agree - a very important IMHO when doing workflow and TDI development is to ensure that somebody just looking at the flows should be able to deduct the functionality of the flow.

    So - it is better seen from a TCO point of view to have a set of script nodes with clear naming of what they are doing instead of one script node doing everything - the latter is actual considered "Best Practice" -  but that is due to performance reasons and that should only be a problem in really highload environments. And in that case you better avoid these kind of things totally (write extension/JavaScript extension instead).

    Regards

    Franz Wolfhagen

    To Mark99, Franz and gooitsupport, thankyou very much for you responses and links to workflow best practices.  The workflow is working nicely now and I have removed the code from the start node into a separate script node.

     

    Regards,

    John D