Questions tagged [fflib]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
29 views

fflib service layer naming convention

I read an article about the service layer here. The names for the services are OpportunitiesService.cls or AccountsService.cls. Does the names of the services always follow the pattern {plural Sobject}...
2
votes
1answer
39 views

not possible to register an object id with an object of the same type

I am registering two new accounts using the fflib unit of work. The code as follows: fflib_ISObjectUnitOfWork uow = Application.unitOfWork.newInstance(); Account account1 = new Account(Name = '...
0
votes
1answer
29 views

Register relationship with FFLIB unit of work

I have been trying to store a big payload as Files and link it to the object EVENT_LOG__c.In the Service layer we have few methods that are called for different events. public void processEvent(String ...
0
votes
0answers
21 views

Storing JSON payload as Files based on unit of work pattern

I have been trying to store a huge JSON Payload(received as a response from external Integration) as a salesforce File and attach it to the Object's(called as EventLog) record.But my org is based on ...
0
votes
0answers
36 views

Enterprise Pattern : AccountsSelector: @Override specified for non-overriding method: List<Schema.SObjectField> sptSObjectFieldList()

We have AccountsSelector class extending ApplicationSObjectSelector abstract class from at4dx library. ApplicationSObjectSelector class has public virtual method getSObjectFieldList() I have ...
2
votes
2answers
48 views

Support of database class methods with fflib UnitOfWork

I am getting a JSON response with multiple account records which I have to upsert in Account object. I am trying to implement this requirement using UOW provided by the fflib library. Is there a way ...
0
votes
1answer
51 views

Why does the FFLIB framework enforce CRUD security and sharing rules by default for Domains?

In FFLIB, a Domain enforces CRUD security and sharing rules by default. We use FFLIB Domains for implementing triggers. In the Salesforce standard, triggers run in system context, meaning they don't ...
6
votes
2answers
171 views

Mocking Database.QueryLocator in Unit Tests using fflib Apex Mocks

Assume we have some basic AccountSelector class that has different implementations of the selector method. QueryLocator variation is helpful once we need to take advantage of SOQL for loops or to use ...
0
votes
0answers
51 views

SOQL aggregate statement using FFLIB

Please, It is possible to write a SOQL aggregate statement using fflib_SObjectSelector? For example, I have this SOQL request: SELECT DX_Support__r.Name support, SUM(total__c) total FROM ...
0
votes
1answer
44 views

System.QueryException: No such column 'CurrencyIsoCode' on entity 'OpportunityContactRole' while using fflib library

I am using fflib library and querying OpportunityContactRole object in trigger. But its throwing below error -> Opportunity_Trigger: execution of BeforeUpdate caused by: System.QueryException: No ...
1
vote
0answers
20 views

fflib and Knowledge__kav

does anyone use ffLib with Knowledge__kav? I am facing weird issue when using those. When user without knowledge access fire logic and go trough centralized class that stores references to all ...
0
votes
0answers
38 views

Mock Selector in fflib

I am new to fflib, currently I am struggling with tests. Maybe there is someone who can help me :) public class someclass{ SEL_Contact contactSel = SEL_Contact.newInstance(); public ...
0
votes
2answers
71 views

creating tasks for a queue using fflib

I created a queue and set the queue to handle the task Object: I can assign a task to a queue and insert the task if I do it via the "Anonymous apex"; however, if I run the same code via a ...
1
vote
1answer
252 views

mocking database methods using fflib

As fas as I know it is not possible to mock the methods under Database because salesforce does not allow mocking static methods. However, One can circumvent this limitation by wrapping the static ...
0
votes
1answer
103 views

mocking related objects using fflib

I am trying to add records to Opportunity.OpportunityLineItems; however, I got an error that that field is read-only. I tried to mock that field via fflib, code as follows: fflib_ApexMocks mocks = new ...
1
vote
0answers
58 views

ApexMocks - Not able to verify Insert of a sObject record

I'm trying to write unit test (using fflib framework) for a piece of functionality where on insertion of an object files are created. This is the main piece of code i'm trying to cover: ...
0
votes
1answer
60 views

issue with pre-defined execution order of fflib unit of work

The commitWork() method in the class fflib_SObjectUnitOfWork has a predefined order of execution that always sends the emails at last, as it can be seen as follows: private void doCommitWork() { ...
0
votes
0answers
33 views

fflib Unit of Work - Get All Modified SObjects?

I have recently been moving all of my code over to an enterprise pattern, more specifically the fflib Apex Common framework. I have a habit of making a batch job that spits out at the end exactly what ...
0
votes
1answer
100 views

benefits of using interfaces in fflib service layer

I am looking at the fflib-apex-common-samplecode, and I see that the AccountsSelector uses an interface IAccountsSelector, see below: public class AccountsSelector extends fflib_SObjectSelector ...
3
votes
2answers
113 views

ApexMocks, Test.createStub and System.TypeException @Override specified for non-overriding method

Simple use case for ApexMocks of a Service layer class, something I've done a 100 times fflib_ApexMocks mocks = new fflib_ApexMocks(); OpportunitiesServiceImpl mockOpportunitiesService = (...
0
votes
1answer
51 views

fflib-apexmock not getting verified

I am using fflib mocks and at4dx Trying to test a simple controller method which is calling a selector method. Controller Method: public with sharing class MyController { public static String ...
2
votes
0answers
58 views

register relationship

I am using the unit of work design pattern (fflib) to persist objects; however, it does not register relationships, code as follows: fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork( ...
1
vote
2answers
488 views

How to use fflib_SObjectSelector class? [closed]

I just came across Apex Enterprise Design patterns and this architecture has been really useful. I am trying to implement the selector layer and when I try to extend the fflib_SObjectSelector class, I ...
1
vote
1answer
156 views

Selector Layer - fflib_SObjectSelector error on Cross-Object and Sub-Select Queries

I'm working on a skipe for this fflib and I'm facing this error when I try to execute a Cross-Object or Sub-Select query:. |WARN|fflib_QueryFactory.subselectQuery(Schema.SObjectType) is deprecated ...
5
votes
1answer
357 views

Why are my matchers not working after adding an overloaded method?

To help getting past our permission checks during unit tests to test actual functionality, I created a mocking class so people could just call the mocking method they needed from that class for the ...
2
votes
1answer
61 views

Do we have to force all FFLIB classes with `with sharing` keywords to pass security review?

I'm using FFLIB classes in my managed package and i just wanted to know if i should mark FFLIB classes use in my package with with sharing keyword to follow security review requirements ? Thanks,
4
votes
1answer
69 views

How to mock App Exchange package's API response?

I am using an app exchange package in my code, they have exposed a few global methods that I can use to get my job done. It all works beautifully. The issue comes with testing. I want to test ...
0
votes
1answer
302 views

Doing something dumb with queryfactory and relationship query

I've been using the fflib pattern in salesforce development since before the introduction of the query factory. I'm having a problem making a simple relationship query work using the queryfactory. ...
2
votes
1answer
270 views

Pros and cons of fflib-common-apex for ISV

This question is aimed to summarize advantages and disadvantages of using fflib-common-apex for developing managed packages for AppExchange. Overall fflib-common-apex and mocks are helpful and speed ...
5
votes
2answers
1k views

fflib selector - configure Read and FLS - fflib_SObjectSelector vs fflib_QueryFactory

We're working on a managed package and planning to list it on AppExchange. We are using the fflib-apex-common library in our app. Now the question: what's the best way to configure Read and FLS when ...
2
votes
2answers
53 views

Which unit tests should check read access for user?

We are using fflib-apex-common in our project, and we implemented several selectors. By default fflib_SObjectSelector checks for Read permission. But now I am wondering what type of tests, and at what ...
1
vote
1answer
1k views

FFLIB Unit of work. how to register a relationship on both new and existing record?

I have been trying to use the FFLIB enterprise service layer module to both insert a new record and update an existing record while registering relationships between both but I am unable to update the ...
1
vote
1answer
2k views

fflib apex common Usage [closed]

We have a existing salesforce implementation, we have most of the logic in triggers and trigger handlers. We are still using classic and no mobile or other UI. But still we are planning to implement ...
0
votes
1answer
140 views

How to add mandatory where clause in SObjectSelector subclasses

I have a Product selector class and would like to enforce a mandatory check on a Product field for every query on products. I'm assuming it has something to do with the QueryFactory, but since there ...
5
votes
1answer
242 views

What value is there in an Application Service Provider

As I implement Andrew Fawcett's, Apex Common library referring to the fflib-apex-common-samplecode when necessary, I note that his ObjectService classes (i.e. OpportunitiesService.cls) are really more ...
4
votes
1answer
456 views

Apex Enterprise Patterns: Should UOW only be used with a DML transaction?

After completing the Apex Enterprise Patterns (AEP) trails from trailhead, there are a few questions that I have. One being, when is it necessary to use the Unit of Work (UOW) layer? Considering it is ...
1
vote
1answer
2k views

Salesforce Selector layer - subquery

We have been using FF library for Separation of Concerns framework and it is working great. We need to add subquery to it, but running into issues. Example I am following is from this article: https://...
-1
votes
1answer
633 views

Warning when using fflib_QueryFactory

When performing a sub query, I get the following message: WARN|fflib_QueryFactory.subselectQuery(Schema.SObjectType) is deprecated and will be removed in a future release. Use fflib_QueryFactory....
3
votes
1answer
1k views

fflib_ApexMock: How to mock static methods?

Static methods are called without creating instance of a class. The fflib_ApexMock library gives option to mock, but how to call static methods when mocking a class. Like in Mockito we have ...
3
votes
2answers
2k views

Stuck on Unit of Work Principles test in Trailhead

I am working on the Unit of Work Principles trailhead and seem to be stuck, I cannot get it to pass even though the test passes. I surmise it may be because it is testing other tests and looking for ...
1
vote
1answer
314 views

how to prevent recursive trigger when using the financialforce enterprise design patterns library?

Trying to implement the popular Financialforce enterprise design patterns library, and not clear on if it provides baked in capability to prevent a trigger recursion. I've looked through the core ...
2
votes
1answer
671 views

Hello World for APEX Mocks

I am working on a project in which we need to test an APEX REST Service in such a way that no actual data is created in Salesforce during the testcases execution. I am new to APEX Development. ...
4
votes
3answers
715 views

How to unit test service layer without DML

Looking for best practices/suggestions on how to unit test a service layer method that creates new records based on input without having to issue the DML. An example would be ...
2
votes
1answer
397 views

Getting error when trying to use fflib

I am trying to learn fflib, in this i do have 3 layers Service, selector and domain level. I am getting a list of opportunity records to display on VF page using selector and I have added all these ...