Comments (4)
Hi @Pooja-sfdc, there is no need to modify the property.
The best practice for creating records with Forceea is totally different from what is included in your attached code.
Generally we create records by Templates (Forceea.Template class). There are plenty of examples in the Success Guide (see Data factory section).
If you insist on creating data without Forceea.Template, you should use the following sample:
FObject obj = new FObject(Account.SObjectType, 10) \\ 10 is the number of records
.setDefinition(.Account.Name, '......'.)
or
FObject obj = new FObject(Account.SObjectType)
.setNumberOfRecords(10)
.setDefinition(.....)
``
Again, please see the Success Guide for examples. For you reference I attach a sample Data Factory class:
public with sharing class DataFactory {
public final static String ACCOUNTS = 'Accounts';
public final static String MAJOR_ACCOUNTS = 'MajorAccounts';
public final static String OPPORTUNITIES = 'Opportunities';
public final static String B2B_OPPORTUNITIES = 'B2BOpportunities';
public final static Integer DEFAULT_NUM_ACCOUNTS = 10;
public final static Integer DEFAULT_NUM_OPPORTUNITIES = 40;
public static Forceea.Template templateAccounts() {
return new Forceea.Template()
.add(ACCOUNTS, new FObject(Account.SObjectType)
.setNumberOfRecords(DEFAULT_NUM_ACCOUNTS)
.setDefinition(Account.Industry, 'random type(picklist) except(Electronics,Energy)')
.setDefinition(Account.ShippingStreet, 'random type(street) group(shipping)')
.setDefinition(Account.ShippingPostalCode, 'random type(postalCode) group(shipping)')
.setDefinition(Account.ShippingCity, 'random type(city) group(shipping)')
.setDefinition(Account.ShippingState, 'random type(state) group(shipping)')
.setDefinition(Account.ShippingCountry, 'random type(country) group(shipping)')
);
}
public static Forceea.Template templateMajorAccounts() {
return new Forceea.Template()
.add(MAJOR_ACCOUNTS, templateAccounts().getFObject(ACCOUNTS)
.setVariable('recordType', 'MajorAccount')
.setDefinition(Account.RecordTypeId, 'static value({@recordType})')
.setDefinition(Account.Name, 'static value(Account-)')
.setDefinition(Account.Name, 'serial type(number) from(1) step(1) scale(0)')
.setDefinition(Account.AnnualRevenue, 'random type(number) from(1000000) to(100000000) scale(2)')
);
}
public static Forceea.Template templateOpportunities() {
return new Forceea.Template()
.add(OPPORTUNITIES, new FObject(Opportunity.SObjectType)
.setNumberOfRecords(DEFAULT_NUM_OPPORTUNITIES)
.setVariable('today', Date.today())
.setDefinition('$days', 'random type(number) from(-60) to(60) scale(0)')
.setDefinition(Opportunity.CloseDate, 'static value({@today})')
.setDefinition(Opportunity.CloseDate, 'function-add field($days)')
.setDefinition(Opportunity.StageName, 'random type(list) value(Prospecting,Qualification, Needs Analysis)')
.setDefinition(Opportunity.Amount, 'random type(number) from(1000) to(10000) scale(2)')
);
}
public static Forceea.Template templateB2bOpportunitiesWithRelated() {
return new Forceea.Template()
.add(templateMajorAccounts())
.add(B2B_OPPORTUNITIES, templateOpportunities().getFObject(OPPORTUNITIES)
.setVariable('recordType', 'B2BOpportunity')
.setDefinition(Opportunity.RecordTypeId, 'static value({@recordType})')
.setDefinition(Opportunity.Name, 'static value(Opportunity-)')
.setDefinition(Opportunity.Name, 'serial type(number) from(1) step(1) scale(0)')
.setDefinition(Opportunity.AccountId, 'serial lookup(Account) mode(cyclical) source(forceea)')
);
}
public static void insertAsync() {
Forceea.Template template = DataFactory.templateB2bOpportunitiesWithRelated();
new FObjectAsync(template)
.setNumberOfIterations(1000)
.setNumberOfJobs(20)
.insertRecords();
}
public static void deleteAsync() {
Forceea.Template template = DataFactory.templateB2bOpportunitiesWithRelated();
new FObjectAsync(template)
.deleteRecords();
}
}
from forceea-data-factory.
Hi @nmitrakis ,
Thanks for above clarification!
I tried accessing the Forceea user guide, which I was trying to access through below link:
https://nmitrakis.com/Forceea131-user-guide
But I'm unable to access the same.
Could you please send me the link to access the guide which i can access easily?
Thanks & Regards,
Pooja Agrawal
from forceea-data-factory.
@Pooja-sfdc you've been using a very very old version. Now we are on v2.6!
You can find the latest Success Guide at https://rebrand.ly/cgh14.
from forceea-data-factory.
Thanks @nmitrakis ! I will close the issue.
Kind Regards,
Pooja
from forceea-data-factory.
Related Issues (20)
- New class Forceea.Template will handle templates
- A global or local variable keeps the same value
- The FObjectAsync will accept Forceea.Template as a constructor argument
- The classic Forceea app will be removed
- Asynchronous bulk update
- Replace "delete" with "remove" in the FObject methods that "remove" field definitions
- New FObject instance method getVariable and static method getGlobalVariable
- New FObject instance methods setMaxNumberOfRecordsOnAsyncDelete and setMaxNumberOfRecordsOnAsyncUpdate
- Support for permutations on async insertion
- The FObject method setWhereClauseOnAsyncDelete(whereClause) will filter the records to be deleted
- The FObject method setWhereClauseOnAsyncUpdate(whereClause) will filter the records to be updated
- Maximum stack depth has been reached HOT 6
- Bypass the limit, executing more than 5 Queueable Apex chained jobs on Developer/Scratch orgs
- Replace public access modifiers with global for classes/methods
- Error "Too many DML rows: 10001" when asynchronously deleting records using setMaxNumberOfRecordOnAsyncDelete(15000)
- Lists HOT 4
- Support the method setGroupName in asynchronous processes HOT 1
- Support the method setStandardPricebookEntries in asynchronous processes HOT 1
- Demo DataFactory class with Templates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forceea-data-factory.