How to pass additional custom parameters in Form call?

Hi Community,

I want to launch a custom Form from an CommandBarMenu CUI event. Users can select multiple items in the grid and then click the CUI button. Then a form shall open up in which users can do certain operations with the selected items.

I want to pass the id´s of the selected items to the launched Forms. But I right now didn´t find an elegant way to pass the idlist or multiple items. I right now create a temporary item, but I am not very happy with the solution. I somehow think that passing custom paramters to Forms should be possible. I just don´t know how.

Does anyone of you know a solution? My main problem is not the actual passing of the custom parameters. But I don´t know how to retrive it later. 

Here´s my current code;

var idlist = options.selectedRowsIds;
var inn = new Innovator();


// Create temporary item to pass idlist (workaround!)
var tempItem = inn.newItem("Part");
tempItem.setProperty("_idlist",idlist);

// Launch Form
var topWnd = aras.getMostTopWindowWithAras(window);
topWnd = topWnd.main || topWnd;


var params = {
title: 'do something',
item: tempItem,
formId: "9336D7E4DD244391AEC9593DD8A5D85B"'
aras: aras,
//innovator: this.getInnovator(),
dialogWidth: 1200, // set width int
dialogHeight: 600, // set height int
content: 'ShowFormAsADialog.html',
idlist: idlist <<<<<<<<<---------------------------------------- // is it somehow possible to pass custom parameters with the form to avoid the tempItem? And how to I get it?

};

Thanks for any ideas!

Angela

Parents
  • Add the below code to your Aras method. Hope this helps


    wnd.ArasModules.Dialog.show('iframe', params);

    -----in your ShowFormAsADialog.html---------------------

    addd this line

     var  args = window.frameElement.dialogArguments; // get the params from Aras method

  • Hi Truc,

    I have tried this  to add custom parameters

    var param = {
    aras: top.aras,
    type: 'SearchDialog',
    dialogWidth: 700,
    dialogHeight: 450,
    itemtypeName: 'sb_Sample',
    multiselect: true,
    sourceItemTypeName: 'sb_Sample',
    sourcePropertyName: 'sb_filter_action',
    parentItem:thisItem1,
    productTypeVal:productType,
    itemContext : testDefArray
    };//Test Definition Param

    var topWnd = top.aras.getMostTopWindowWithAras();
    var wnd = topWnd ? topWnd : window;
    //opening Test definitions search dilog
    wnd.ArasModules.Dialog.show('iframe', param).promise.then(callback);
    var args = window.frameElement.dialogArguments;

    And to get the value to filter in other method

    I added:

    var m_parentItem=inArgs.parentItem;
    var m_productType=inArgs.productTypeVal;

    But I couldn't able to get the value in another method to filter can you check is there any wrong in this code

  • It seems you missing --> content:

    var param = {
    aras: top.aras,
    type: 'SearchDialog',
    dialogWidth: 700,
    dialogHeight: 450,
    itemtypeName: 'sb_Sample',
    multiselect: true,
    sourceItemTypeName: 'sb_Sample',
    sourcePropertyName: 'sb_filter_action',
    parentItem:thisItem1,
    productTypeVal:productType,
    itemContext : testDefArray

    content: '../customer/abc.html' // Put path to HTML file here, 
    };

    In the abc.html file , you can catch the variable passed from the triggered method you call.

    var  args = window.frameElement.dialogArguments; // get the params from Aras method

    I'm not sure what you are trying to do in your case, but inArgs is the context variable you get from the event, I could be wrong.

    wnd.ArasModules.Dialog.show('iframe', param).promise.then(callback); // this line of code creates another thread which runs abc.html 

Reply
  • It seems you missing --> content:

    var param = {
    aras: top.aras,
    type: 'SearchDialog',
    dialogWidth: 700,
    dialogHeight: 450,
    itemtypeName: 'sb_Sample',
    multiselect: true,
    sourceItemTypeName: 'sb_Sample',
    sourcePropertyName: 'sb_filter_action',
    parentItem:thisItem1,
    productTypeVal:productType,
    itemContext : testDefArray

    content: '../customer/abc.html' // Put path to HTML file here, 
    };

    In the abc.html file , you can catch the variable passed from the triggered method you call.

    var  args = window.frameElement.dialogArguments; // get the params from Aras method

    I'm not sure what you are trying to do in your case, but inArgs is the context variable you get from the event, I could be wrong.

    wnd.ArasModules.Dialog.show('iframe', param).promise.then(callback); // this line of code creates another thread which runs abc.html 

Children
No Data