Big news! The community will be moving to a new platform April 21. Read more.
Big news! The community will be moving to a new platform April 21. Read more.

Passing Information from a Child subtask to a Parent

Passing Information from a Child subtask to a Parent

I have not found a way to keep dialog going between Parent workflows and subtasks.  We have management in the parent workflow that will submit a subtask requesting work and need to have dialog from the child subtask return from the implementers out in the field.  But the problem is the implementers need to have a open dialog with management.

Is there a way to have a Resolutions Text journal on the parent workflow where all management in the parent workflow view results 

Labels (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments
I have done this. I used teamscript to do it. I used a Post Transition script from the subtask. The script finds the parent and appends data to a text field. I also go the other way with another script where the parent gets updated and all of the related subtasks get updated. The relationship between parent and child became more important because I had to limit where updates were done on those fields based on the workflow. Not at work or I would post a snippet of code.
Ok, here's the code... I'm not a programmer. I dabble. I've cleaned it up from the original, it should work, you'll have to change it for your variables and tables. '************************************************************************************* ' Append Rejection field data to parent script ' This script places the subtask rejection information into the parent rejection field upon ' a subtask rejection. ' ' ********************************************************************************************* ' --------------------------------------- Option Explicit ' Requirements: ' This script relies on Shell.Item, which only exists in pretransition, ' post-transition ' ' Note: if reading a drop-down list field, do not use the 'GetFieldValue() ' function. Instead, retrieve the actual Field 'object, and use its ' GetDisplayValue() method. ' Require all variables to be declared before use 'Define all global variables Dim current, main_table_name,event Dim nMastTblId,nTaskID,nTaskTableId,myRecord Dim whereclause, nMastTaskId, TaskItem, issueID Dim reason_for_action_var,reason_for_action_concat_var,eventType 'This gets the current issue or incident or record being worked on If Ext.ShellHasProp( "item" ) Then issueID = Shell.item.GetID() Set current = Shell.item Else issueID = 0 End If const MAIN_TBL_NAME = "YOUR_PARENT_TABLE_NAME" 'Put in your parent table name From the database If Not current Is Nothing Then event = Shell.TransitionId 'the ID of the transition, unlike the TransitionName it cannot change eventType = UCase( Shell.Context) 'the type of event. For example: pre-transition, post-transition, etc. End if '******************************************************************************************* ' Read the current subtask and gather the Reason for Action '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim fldList, fldObj2,fldObj3, fldObj4, reason_for_action_obj, ItemID_Value Dim Application_Value,Item_Type_Value Set fldList = current.Fields() Set fldObj2 = fldlist.FindField( "Application Name" ) 'Application Field Value Set fldObj3 = fldlist.FindField( "Item Type" ) 'Item Type Field Value Set fldObj4 = fldlist.FindField( "Item Id" ) 'Item Id field Set reason_for_action_obj =fldlist.FindField("Reason for Action") Call fldObj4.GetDisplayValue( ItemID_Value) ' The line below concatonates the Reason for action information that will be put in the Parent Reason for Action reason_for_action_concat_var = "Subtask Rejection Information: " & reason_for_action_var & " " & ItemID_Value & " " & Item_Type_Value & " " & Application_Value 'End If '************************************************************************************************************************************ If eventtype = "POST-TRANSITION" Then 'Let's be sure this only happens on the post transition. main_table_name = Ext.TableId( MAIN_TBL_NAME, "display") 'TS_SUBTASKS is the table that holds the relationships between parent and subtasks. Set myRecord = Ext.CreateAppRecordList(Ext.TableID("TS_SUBTASKS")) 'Loop through your record to find the parent to your subtask. whereclause="TS_MASTERTABLEID="& main_table_name &" AND TS_SUBITEMID="& issueID ' where there is a parent to the sub. If myRecord.ReadWithWhere(whereclause) Then For Each TaskItem in myRecord call TaskItem.GetFieldValue("MASTERITEMID",nMastTaskId) call TaskItem.GetFieldValue("MASTERTABLEID",nMastTblId) If nMastTblId "" and nMastTaskId "" Then call GetTaskIDAndState(nMastTblId,nMastTaskId) 'call the function End If Next else Shell.redomessage=Shell.RedoMessage&"Error Subtask_to_Parent_Script in the ReadWithWhere statement" End if end if 'If eventtype = "POST-TRANSITION" Then '****************************************************************************** function GetTaskIDAndState(nTaskTableId,nTaskID) 'Function to put data into the parent record. Dim myTaskRec,whereTClause,Storage,Consol Set myTaskRec=Ext.CreateAppRecord(nTaskTableId) whereTClause="TS_ID="&nTaskID If myTaskRec.ReadWithWhere(whereTClause) Then 'Getting the latest Storage Listing from the parent. Call myTaskRec.GetFieldValue( "REASON_FOR_REJECTION", Storage) 'Concatonate relivant subtask field information that will go back into the parent. Storage = " " & Shell.User.GetDisplayName() & ": " & vbcrlf & reason_for_action_concat_var & vbcrlf & vbcrlf & Storage call myTaskRec.setFieldValue("REASON_FOR_REJECTION", Storage) 'Add the storage value into the parent field. Call myTaskRec.UpdateWithLock(True) End If end function '*********************************************************************
'Define all global variables Dim current, main_table_name,event Dim nMastTblId,nTaskID,nTaskTableId,myRecord Dim whereclause, nMastTaskId, TaskItem, issueID Dim reason_for_action_var,reason_for_action_concat_var,eventType http://howtotakescreenshotpro.com/android/ http://howtotakescreenshotpro.com/ios/ http://howtotakescreenshotpro.com/gnome/
Top Contributors
Version history
Revision #:
2 of 2
Last update:
‎2020-01-30 18:16
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.