Hi all... just making sure that there is no easier...
# suitescript
m
Hi all... just making sure that there is no easier way to this... to update a field on invoices once a payment happens (which could be through different records), you have to have an UE script deployed over all types of those payment records, and once it is saved, you fetch the invoice ID (which could be through different way depending on the script... for ex: one record it would have it in the
created from
field, other scripts would have it in the applied to sublist) and then update it, right?
e
If you need to respond immediately as the Payment is created, then yes, User Event is the entry point for that.
Hard to say if that's the "best" approach for your overall business need and system architecture
m
I recommend a scheduled script or M/R running on the invoice. Looking for paid in full invoices where your field is empty. You can run every 15 min which makes it way less complicated and lower impact to performance because it runs in the background. I know everyone says they need things updated “right away” or in “realtime” but a 15 min lag is almost nothing throughout the day and I have yet to find a business process that can’t support a 15 min lag. Just my two cents
m
I will discuss it with the team. Thanks
r
Utilizing the N/task module in a User Event script to schedule a Map/Reduce script is a great strategy for offloading processing tasks from the invoice record. This works efficiently as long as immediate data processing isn’t required for the invoice before the customer’s interaction is completed. It’s also a good idea to have a separate scheduled Map/Reduce script instance to regularly check for any invoices that might have been missed due to the task scheduling constraints, especially when dealing with a high volume of invoices. This two-pronged approach ensures that while the bulk of the processing is offloaded, you still maintain a reliable safety net for catching any invoices that slip through the initial scheduling.
n
^^ if you go that route be sure to manage failures due to the lack of a deployment and create one.
r
@NElliott that is why you schedule a routine cleanup. Honestly, it’s not a bullet proof plan and isn’t encouraged, just an option.
n
Better to just create a new deployment if that's the issue. imho. 🤷🏻‍♂️
r
@NElliott I’m curious, how would you go about programmatically setting up a new deployment on the fly? I’ve tried juggling multiple deployments before, and it can get pretty messy, especially when you’re aiming for an always-ready setup for immediate task execution. Any insights on making this process smoother would be super helpful.
n
Nah it's actually pretty easy in a UE to use n/task and check the message back to see if there's no deployment available and create one.
e
I've worked on multiple teams now who have written utility modules that will do this ^ check-and-deploy strategy. If going that route, I'd also recommend Yet Another Map/Reduce to subsequently cleanup the glut of dynamic deployments that get created.
👍 1
💯 1