I have a UE script that runs for all contexts. Nor...
# suitescript
s
I have a UE script that runs for all contexts. Normally, when a SalesOrder is created or updated, even if that is done by a script, it will fire. In fact, it is set to fire on ALL contexts. But it does NOT seem to fire when a sublist item is fulfilled. Even though the record changes to show quantity fulfilled. So I created another UE script that fires when an Item Fulfillment is created. It retrieves the associated Sales order, then loads it, sets a custom field, and saves it. But that also is not firing the SalesOrder UE script. Why would it not fire? How do I get that script to run when a fulfillment is created? Thanks
i
Item Fulfillments don't automatically trigger the relates Sales Order. What you did of creating a script on the IF to load and save the SO would be the route to take. However, a User Event Script will not trigger another UE script. Depending on the logic involved you can run the same logic on your IF script. Alternate would be from your IF script you can call some other script type to reload and save the record (Ex. call a suitelet).
1
s
sigh... Thanks.
netsuite 2
s
better to consider if you can redesign your process to work in bulk with background processing (e.g. Scheduled or M/R)
f
One approach to consider is firing an event to a topic and then have the relevant processes subscribed to the topic. This approach is more involved but opens a lot of doors that you'll be glad you opened. Probably also narrow the scope of that UE script. For example, it likely does not need to trigger on the bank reconciliation context ....it's a good habit and you'll get style points from your friends.
s
So I am trying to call a suitelet from the aftersubmit UE script. It does not seem to be working. I have tried several versions that I found online but I cannot seem to get it to work.
I found it. Problem was old postings. Things have changed and it is a simple one statement call to https.requestSuitelet now and can include parameters. All internal. No need for the allow when not signed in flag.
🙌 1
f
Thanks for sharing. I hadn't read up on that module ('N/https') for a bit, and you just helped me enhance a solution. I frequently use Suitelets as an entry point, but then exposing the logic to restlets to accommodate my desire for an API first approach which facilitates the automated testing. Funny thing how you try to offer to help and in the end you end up being the one getting helped! Thanks @Scot Sunnergren
s
What do you use for API integration testing @Fred Pope? We settled on Playwright
🙌 1
f
@Shawn Talbert I've been using Karate but Playwright looks very cool. Node/Ts is my paved road. The testing is invaluably important and becomes something I rely on, but the process of thinking about the testing is where the gold is. Writing your code to be testable improves it overall.
💯 1