Awesome! I’m glad your payment creator is on its way!
Not sure I understand your question regarding a calendar. You want to display the created payments in a calendar on the day they’re due? If so, then you’ll want to install the Full Calendar plugin, set the type of events to Payment and the source to whichever list of Payments is appropriate for the user to see. The source could be a search for Payments with constraint or, based on your next question, could be a Contract’s List of Payments.
So to attach each payment to a Contract through the API workflow, you’ll need to send the Contract as a parameter as well so that you can have an action that follows “Create a New Payment” for “Make a Change to Contract” (where Contract is your Contract parameter value).
The change would be to a list field (under Contract) you can call “List of Payments”. This list would add the result of the previous step (the new Payment that was just created). Every time a payment is created, it gets added to the Contract.
So… Schedule API Workflow on a List (to create payments) with a parameter for Contract > API Workflow will trigger: 1. Create a New Payment and 2. Make a Change to Contract.
As an extra way to link your payments to contracts, I would also have a field (type Contract) under Payment to reference back to the Contract per Payment…
Create New Payment > Make a Change to Contract > Make a Change to Payment, where the payment is result of step 1 and the change is to save the Contract to this new field.
THX great approach! But I would neet to have the only monthly view, let’s say the upcoming 12 months from the current date. And for each month, doing a search for every payment added to a “total monthly payments” I dont really need the calendar by day, it’s more like a cashflow. I did checked the calendar plugin, but the only possible view is for the daily thing.
that’s why I sas thinkging about a repeating group, where each columnn is an upcoming month, and for each column doing a search for every payment. Is this approach bad? or I could get the same having a different calendar view?
About associating a policy with payments,
I currently add a field to each payment saying to what (policy=contract) it’s for…
Hey, Martin! Sorry, I didn’t catch your earlier response (If I’m not tagged, I often miss them )
You should be able to create that kind of monthly view with a repeating group, yes. Each cell would reference “current date/time +(months): current cell’s index”. So the first cell would be next month (this month + 1), the 2nd cell would be 2 months from now (this month + 2), etc.
For adding the payments to the policy, you’re almost there. In the API Endpoint, you want to make a change to “id_poliza_venci_api” - you actually have the action circled in the 2nd to last screenshot.
The field to change is “plan_pagos_poliza” so that it reads plan_pagos_poliza add result of step 1
Every time a payment is created, it will be added to the policy’s list of payments. It happens one at a time as the API workflow is run for every payment, not as a batch.
So just remember when you use the “Schedule an API Workflow on a List” that you send the value of the policy to that parameter (id_poliza_venci_api).
As a suggestion, you should also have a Poliza field under the Cuotas_Poliza type to reference the policy in the other direction. So when you create a new Cuota_Poliza (step 1 in the API), you can have that field Poliza = id_poliza_venci_apo as well. That way you have 2 way reference… Every payment references the policy, and every policy references a list of payments.