Hybrid App Message Data Functions

Access the Hybrid App message data functions.

A Hybrid App 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 getDataMessage(). 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.

Example 1

A typical Hybrid App 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;
}