Workflow Message Data Functions

Access the mobile workflow application message data functions.

A mobile workflow application has an in-memory data structure where it stores data. This data is used to update the controls on the screen through updateUIFromMessageValueCollection(). Values are extracted from those controls and used to update the data through updateMessageValueCollectionFromUI().

You can program the data content and use it to make decisions on the client. To get the active instance of this data structure, you start by calling getWorkflowMessage(). This returns a WorkflowMessage object. This object has a function, getValues(), that is used to return the top-level MessageValueCollection object. This object has a list of key-value pairs, represented by MessageValue objects and is retrieved by calling getData(key). getData() returns either a single MessageValue object, or an array of MessageValueCollection objects.

Method Description
getCurrentMessageValueCollection(listKey) Recommended for listviews so that the user gets the appropriate part, or values, of the message, for the current screen.

Each row in the listview corresponds to a Values section. So, for example, if the user is on the details screen and getCurrentMessageValueCollection is called, the portion that matches the listview row the user clicked appears. If getWorkflowMessage is called, the entire message appears.

getWorkflowMessage() Allows the user access to the Mobile Workflow message.
getMessageValueCollectionForOnlineRequest(screenKey, requestAction, keys, keyTypes) Gets the message value collection to be sent in an online request.

Example 1

A typical mobile workflow message might look similar to this.
WorkflowMessage
		.getHeader()		<undefined>
		.getWorkflowScreen()	"salesorderList_newSOCreate"
		.getRequestAction()	"Submit_Workflow"
		.getValues() 		MessageValueCollection
			.getData("salesorderList_newSOCreate_WITHOUT_COMMIT_paramKey")
				.getKey()	"salesorderList_newSOCreate_WITHOUT_COMMIT_paramKey"
				.getType()	"TEXT"
				.getValue()	"1"
			.getData("BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DOC_TYPE_attribKey")
				.getKey()	"BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DOC_TYPE_attribKey"
				.getType()	"TEXT"
				.getValue()	"1"
			.getData("BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_SALES_ORG_attribKey")
				.getKey()	"BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_SALES_ORG_attribKey"
				.getType()	"TEXT"
				.getValue()	"1"
			.getData("BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DISTR_CHAN_attribKey")
				.getKey()	"BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DISTR_CHAN_attribKey"
				.getType()	"TEXT"
				.getValue()	"1"
			.getData("BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DIVISION_attribKey")
				.getKey()	"BAPI_SALESORDER_CREATEFROMDAT1_ORDER_HEADER_IN_DIVISION_attribKey"
				.getType()	"TEXT"
				.getValue()	"1"
			.getData("salesorderList_newSOCreate_ORDER_PARTNERS_paramKey")
						MessageValue
				.getKey()		"salesorderList_newSOCreate_ORDER_PARTNERS_paramKey"
				.getType()		"LIST"
				.getValue()		MessageValueCollection[]
					[0].getKey()		"6476c1a4-94e9-e5a4-b903-caf2ca613c4a"
					[0].getState()		"add"
					[0].getData("PARTN_ROLE")
								MessageValue
						.getKey()		"PARTN_ROLE"
						.getType()		"TEXT"
						.getValue()		"1"
					[0].getData("PARTN_NUMB")
								MessageValue
						.getKey()		"PARTN_NUMB"
						.getType()		"TEXT"
						.getValue()		"1"

Example 2

getCurrentMessageValueCollection

Handling individual items

var message = getCurrentMessageValueCollection();

var cityObj = message.getData("Customer_city_attribKey");
var city = cityObj.getValue();

var stateObj = message.getData("Customer_state_attribKey");
var state = stateObj.getValue();
         
var zipObj = message.getData("Customer_zip_attribKey");
var zip = zipObj.getValue();

List

var message = getCurrentMessageValueCollection();   
var itemList = message.getData("CustDocs");   
	
var items = itemList.getValue(); 
var noOfItems = items.length;   
var i = 0; 

while (i < noOfItems) {
  var theItems = items[i]; 
  var fileNameObj=theItems.getData("CustDocs_fileName_attribKey");     
  var fileName = fileNameObj.getValue(); 
  i = i + 1;
}