UpdateSubWorkData()
This code sample describes how to create a script that passes data from the Table Values data type from one workflow to another.
Function Boolean UpdateSubWorkData( \ Object prgCtx, \ Integer toID, \ Integer fromID, \ List fields ) // The fields to pass. Undefined = all Assoc data Assoc subWorkData String name Boolean success = True Boolean updateAll = !IsDefined( fields ) //Call the LoadTableValues() script to load the information about //the Table Values data type from the database tables. data = .LoadTableValues( prgCtx, fromID ) success = !IsError( data ) if ( success ) if ( !updateAll ) updateAll = True //Determine which fields to pass from one workflow to another. for name in Assoc.Keys( data.Fields ) if ( !( name in fields ) ) updateAll = False break end end end if ( !updateAll ) subWorkData = .LoadTableValues( prgCtx, toID ) success = !IsError( data ) //Set the values of the workflow attributes in the new workflow //equal to the values of the workflow attributes in the current //workflow. if ( success ) for name in fields subWorkData.Fields.( name ) = data.Fields.( name ) end end data = subWorkData end if ( success ) //Call the DeleteWorkData() script to delete any previous //data that has been stored for the custom workflow //attributes in the database tables. success = .DeleteWorkData( prgCtx, toID ) end if ( success ) //Save the new data. success = .SaveTableValues( prgCtx, toID, data ) end end return( success ) end