You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are starting to use fflib in our projects. We generally run into disagreements on how we access relationship fields. It usually revolves the approach promoted in the discussion boards which uses map<id, string> for each field to set field values in the object. We have use cases where need to basically copy the discount details (close to 6 fields) and stamp it in the quotelineitem when it created if the discount is setup for the sku's family and if the opportunity is of "end customer" record type.
In our case, I need to do the following:
IQuoteLines quotelines = IQuoteLines.newInstance(this.records);
IQuotes quotes = IQuotes.newInstance(
IQuotesSelector.newInstance().selectById(
quotelines.getQuoteIds()
)
);
List<String> recordtypeids = Process_Constant__mdt.getInstance('Discount_Enabled_Opp_RecordType')
.Value__c.split(',');
Set<Id> opportunityIds = quotes.getOpportunityIds();
IOpportunities opps = IOpportunities.newInstance(
IOpportunitiesSelector.newInstance().getRecordIds(opportunityIds)
).selectByRecordTypeId(recordtypeids);
IQuotes endcustomerQuotes = quotes.selectByOpportunityId(opps.getRecordIds());
quotelines.selectByQuoteId(endcustomerQuotes.getRecordIds());
//let us say we have discounts now
IDiscounts dicounts = IDiscounts.newInstance(<list>)
quotelines.
setDistiMargin(Map<Id, Decimal>) //
setDistiDiscount(Map<Id, Decimal>)
setResellerMargin(Map<Id, Decimal>)
.....
Instead of above,
quotelines.
setDistiMargin(Ma<Product2Id, IDiscounts>)//=> should this set call IDiscounts.getDistiMargin() ?
Is there easy way to pass quote discount domains around and set the fields on the quoteline?
Even for the filtering the opps and quoteline's sku. I have to get quotes, then get opps and filter it. Same for sku's family, get productids and filter by family : This seems like we need additional queries and writing lot of code to a simple filter using relationship filed. Is there an acceptable way to address this concern?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are starting to use fflib in our projects. We generally run into disagreements on how we access relationship fields. It usually revolves the approach promoted in the discussion boards which uses map<id, string> for each field to set field values in the object. We have use cases where need to basically copy the discount details (close to 6 fields) and stamp it in the quotelineitem when it created if the discount is setup for the sku's family and if the opportunity is of "end customer" record type.
In our case, I need to do the following:
Beta Was this translation helpful? Give feedback.
All reactions