Hopefully it is easy to fix; else it might be a cool challenge ;-)
I am building an application where we try to provide customers a service where we collect offers from partners that we work with.
I have a main form called
Leads where our customer request is being stored.
In this form there is a subform (
Offersummary) with a simple lookup picklist dropdown to select to which partners
(field: Offerpartner) we request an offer. In general we have 3 partners receiving a request from us to make an offer.
Currently the application already sends these partners an email with a link to a prefilled form called
[Offers]. Each partner receives one unique form.
This form is already prefilled with the Partner_ID and the
system ID of the Lead form.
So in short. 1 Lead record is now "linked" with 3 Offer records.
In each offer form the 3 partners add a price [
Offer.price_ex_VAT] and this information i want to bring back into the
[Leads.Offersummary] subform matching the correct row of the partner.
The best solution is that on success of submitting the offer page it updates the Lead record, but this i cannot make work.
So far i have this:
//where to update the record
LeadRecord = Leads [ID == input.Lead_ID];
//iterate over the subform records in the LeadRecord
//update a Status field to notify offers are submitted by partners
LeadRecord.Status = "Offers being submitted";
//iterate over the subform records to specify which Partner has submitted its price.
for each row in LeadRecord.Offersummary
{
item.Price_ex_VAT = input.Price_Offered_ex_VAT;
}
So far no updating is done at all.
Other option was to do it On Load on Edit in the Lead Form (as the admin needs to open the page anyways), but then it autopopulates the first price over every row.
for each row in Offerssummary
{
offerdata = Offers [ Lead_ID== Lead_ID && Partner_Name == row.OfferPartner];
row.Price_ex_VAT = offerdata.Price_Offered_ex_VAT;
}
What to do, what to do?
Best,
Remao