cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve and set Keys Values in js

adrianox1
Participant
0 Kudos

Hi everyone,

i am very new to develop app, (so thanks for the patience)

I'm using the sap mobile Workspace 2.3 and i genereted an hybrid app.

i have 2 mbo(s) first one calls Customer, the second one calls ship_to

on my first screen - "start" i have a button with an online request that calls a screen with the customer list,

i set the list detail back in the start where i also have a textbox with the key of the customer list

so i can see my selection.

So: i call the list, i make my selection and i come back to start where i can see my choice in a textbox.

on my Start screen i have another button to call the ship_TO online request (the customer is parameter for the online request)

and the detail screen of the ship_to list is once again "Start" screen where i have another textbox mapped with the key of the ship_to.

When i select one item from the ship_to list i come back to the start screen and i can see the ship_to selected but i can't see the customer..

i tried to force the value key in javascript using the custom.js

in before show screen

using:

hwc.getCurrentMessageValueCollection().add("key", value)

i tryed also the .remove first but no luck.

Can someone please give me some help?

Any hint will be appreciated

Thanks in advance,

Adriano

Accepted Solutions (0)

Answers (2)

Answers (2)

david_brandow
Contributor
0 Kudos

Think of the in-memory workflow message like a tree. At any given time, you are on a specific level of the tree, and the code the designer generates can only "see" the nodes of the tree that are on the level you are on, you can't see anything on the levels above or below you.

In this case, you have the Customer list at the top level of the tree, level 1, and the details for a specific Customer would be at level 2. If you execute an online request while on level 2, that's where the resulting information will be merged into, so you'll end up with your Ship_TO list at level 2 and the Ship_TO details at level 3. So while you are on level 3, which is where you end up, you can't see the details of a specific Customer because it is on level 2.

You can change this by writing custom code to bind specific UI elements to levels of the tree different than the one you are currently on.

Former Member
0 Kudos

Hi,
  I guess the reason is that customer id comes from different MBO that ship to so after 'ship to' call you screen is filled with fields from ship to MBO which does not contain customer id (so it got empty)

  I will try to add the customer id field to workflow message in   customAfterDataReceived(incomingWorkflowMessage) or put the value directly into field in customBeforeShowScreen

  If none works - put the breakpoint in function updateUIFromMessageValueCollection(screenKeyName, values) and check there who clears that field.

Best regards, Artem