I am trying to generate Vendor payments from map/r...
# suitescript
a
I am trying to generate Vendor payments from map/reduce script and can't understand how to assign Account. Account field is being filtered by Payee (entity) and Subsidiary, but when creating a saved search I see that there is a filter for subsidiary but not for entity. Can you please explain how to create a saved search to get appropriate account records?
āœ… 1
e
The Payee can have multiple subsidiaries, so when creating the payment, you firsts must know the subsidiary you want to create the Payment Record in. Then, whit the subsidiary already set, the Account are filtered by the subsidiary.
And if the payment must be applied to a Bill, the bill already has the subsidiary defined.
I have a custom Suitelet that lets the users filter open bills by subsidiary and currency. A select field allows them to select an Account (filtered by the previous subsidiary and currency). Then they select all the open bills and they are sent to a Map/Reduce that creates each payment applied to each bill.
a
makes sense now, thanks a lot šŸ™
w
@Edgar Valdes we have something similar. Out of curiosity, how do you pass the list of bills to pay to the map/reduce?
e
@Watz The Suitelet lists the bills in a form. The form has a
checkbox
and
internalid
columns. The user select some / all bills and on POST context the script grabs the selected ids and pass them as a parameter to the Map / Reduce.
šŸ‘ 1
w
Ok, your solution seems a lot simpler. We take the post and put it into a single record with the post in a long text field as json. That record is then processed by a M/R into separate records as inactive in map and then we activate them if all were created successfully in summarize. Then a second M/R processes those records into Bill Payments. Some reasons we opted for this (over?) complicated way • be able to capture/display in the suitelet when/if a single bill payment fail/completed. • multiple users can run payment runs across the subsidiaries without needing multiple deployment records for the M/R • be able to create large amount of payments that wouldn't fit inside of a script parameter
šŸ‘ 1
e
Neat, like your solution.
Is not that a heavy process for the summarize stage?
w
The first M/R only processes one of those batch-records per execution (and then restarts if there are more to process) and we have calculated how many records it can activate in summarize. If the user has selected more than it can do in one run, the Suitelet will split them up onto separate batch-records. The limitation on how many can be processed per batch-record is actually on how much information we can store in the long text-field.
āœ… 1