Webcomponents+S360: how to create a button to add a new line in ITELINES

0 views
Skip to first unread message

liviu....@gmail.com

unread,
12:17 PM (9 hours ago) 12:17 PM
to Softone Developers Network
Hello everybody.
I have to add a new item in ITELINES in S360. I failed with JS because the line is always added on each "calculate", and it's a real mess. I could not fix it. 
I am now trying to add it using web components with setData, but with no success. 
I was not able to set even an existing item (to alter the QTY1 for example). I am getting the JSON with getData, I push a new line in ITELINES and post it back but it crashes 

Cannot set properties of undefined (setting 'MTRL')
Please, if you can help with this scenario, I will be very happy.

Here is the script code when i am trying to post back an item - just to see if it works. it doesn't

<script type="text/javascript">
function debugGetData() {
   var command = {
        data: {
            ITELINES: {
                "0": {
                    MTRL: 158766,
                    QTY1: 99,
                    PRICE: 44
                }
            }
        }
    };

    XCon.setData(this, JSON.stringify(command), function(scope, resp) {
        alert("RESP setData:\n" + resp);
    });
}
</script>


Of course, I tried with the standard 
ITELINES: {
               [{MTRL: 158766,
                    QTY1: 99,
                    PRICE: 44
                }]

}
Nothing worked.

Many thanks to anyone ready to spend some time on this issue.
Regards,
Liviu
Reply all
Reply to author
Forward
0 new messages