cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Selecting a control from different pages using a rule on a Tab page - SAP MDK

EacostaJh
Explorer
0 Likes
331

Hi Experts,
I have a tab page that has two tabs and each tab points to different pages where each page has its own controls

EacostaJh_0-1736875670513.png

From the toolBar button I activate a Rule where I want to obtain the elements of each page that has the tab.

This has my rule but it doesn't work for me

EacostaJh_1-1736875960161.png

 




 

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert

You have it just about right but you will want to include #Value in your target path to get the value of the control as opposed to the control reference.  I did a quick test using this rule and it worked as expected.

export default function GetTabFieldValues(context) {
    let ta_sp = context.evaluateTargetPath('#Page:TabA/#Control:FCSimpleProp/#Value');
    let ta_lp = context.evaluateTargetPath('#Page:TabA/#Control:FCListPicker/#SelectedValue');
    let tb_sp = context.evaluateTargetPath('#Page:TabB/#Control:FCSimpleProp/#Value');
    let tb_lp = context.evaluateTargetPath('#Page:TabB/#Control:FCListPicker/#SelectedValue');

    console.log(`Tab A - ${ta_sp} - ${ta_lp}`);
    console.log(`Tab B - ${tb_sp} - ${tb_lp}`);

    return context.getPageProxy().executeAction({
        "Name": '/SCN_00045/Actions/GenericMessageBox.action',
        "Properties": {
            "Message": `Tab A - ${ta_sp} - ${ta_lp}\nTab B - ${tb_sp} - ${tb_lp}`
        }
    });
}