Hey Folks, I want the same functionality as upsell...
# suitescript
r
Hey Folks, I want the same functionality as upsell button does. To do so we have created three scripts(client script, user event and suitelet) 1. UserEvent Script: it will add custom button on sales order 2. *Client Script:*it will redirect to suitelet 3. Suitelet: it will show the item list as sublist(consists of checkbox, item name as sublist fields) but I am stuck at one point. I mean I did not find any way to get data back from the suit let .. once the user select the item on suitlet via a checkbox.. am i missing something? or maybe a anyother way to do so? or this is not possible? Please help me out. Thanks in Advance🙏
r
One way would be to use the postMessage function. In a client script on the suitelet, you can use window.opener.postMessage to post back to the client script on the sales order. In the sales order client script, you would addEventListener in the pageInit. https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
b
you dont actually need to use messages, the suitelet should be on the same domain as the sales order
its not cross origin
window.opener gives full access to the parent window
which means you have access to the parent window's suitescript modules via window.opener.require