-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
11Questions
-
11Replies
Certain group of records to execute in same chunk in Batch apex
Relation Ship
Account (Parent) - Opportunity (Child)
Account (Parent) - Alert (Child)
Question: Is it possible to make a group of records to be executed in same batch in Batch Apex?
Scenario:
10,000 Opportunities will load to the system with below informtion
AccID OppName OppDate
XXXX Op-x1 4-Mar-2022
XXXX Op-x2 4-Mar-2022
YYYY Op-y1 4-Mar-2022
YYYY Op-y2 4-Mar-2022
Requirement is, it should create an Alert for the group of same Account and Same OppDate data.
From the above data it should create 2 Alerts as the data shows two different Accounts on same date.
The challenge here is I couldn't see any control on Batch class to send same set records in one same batch. Any workaround solution for this situation?
Account (Parent) - Opportunity (Child)
Account (Parent) - Alert (Child)
Question: Is it possible to make a group of records to be executed in same batch in Batch Apex?
Scenario:
10,000 Opportunities will load to the system with below informtion
AccID OppName OppDate
XXXX Op-x1 4-Mar-2022
XXXX Op-x2 4-Mar-2022
YYYY Op-y1 4-Mar-2022
YYYY Op-y2 4-Mar-2022
Requirement is, it should create an Alert for the group of same Account and Same OppDate data.
From the above data it should create 2 Alerts as the data shows two different Accounts on same date.
The challenge here is I couldn't see any control on Batch class to send same set records in one same batch. Any workaround solution for this situation?
-
- Anudeep B
- March 30, 2022
- Like
- 0
- Continue reading or reply
Lightning CSS code error while task execution
I am trying to complete the one Lightning task i am getting below CSS error, plz help me on this.

Thanks
Thanks
-
- Anudeep B
- February 20, 2016
- Like
- 0
- Continue reading or reply
Test method not passed
I wrote a test class for this trigger, it is not passed what is the wrong in it?
Trigger:
trigger dupesincont on Lead (before insert, before update) {
for(lead l: trigger.new)
{
if(l.email!=null)
{
list<contact> dupcont = [select id,email from contact where email =: l.email];
string errormessage = 'Name already Exist with this email';
errormessage += ' Record ID is ' +dupcont[0].id;
l.addError(errormessage);
}
}
}
Test Class:
@isTest
public class trigg_dupesincont {
static testmethod void dupesfind(){
string aderror;
contact c = new contact();
c.lastname = 'Jet Lee';
c.email = 'Jets@gmail.com';
insert c;
lead l = new lead();
l.lastname = 'Bruce';
l.email = 'Jets@gmail.com';
list<contact> cons = [select id,email from contact where email =:l.email];
if(cons.size()<0)
{
system.assertequals(0,cons.size());
insert l;
}
else
{
system.assertequals('Already in Contact', aderror);
}
}
}
Trigger:
trigger dupesincont on Lead (before insert, before update) {
for(lead l: trigger.new)
{
if(l.email!=null)
{
list<contact> dupcont = [select id,email from contact where email =: l.email];
string errormessage = 'Name already Exist with this email';
errormessage += ' Record ID is ' +dupcont[0].id;
l.addError(errormessage);
}
}
}
Test Class:
@isTest
public class trigg_dupesincont {
static testmethod void dupesfind(){
string aderror;
contact c = new contact();
c.lastname = 'Jet Lee';
c.email = 'Jets@gmail.com';
insert c;
lead l = new lead();
l.lastname = 'Bruce';
l.email = 'Jets@gmail.com';
list<contact> cons = [select id,email from contact where email =:l.email];
if(cons.size()<0)
{
system.assertequals(0,cons.size());
insert l;
}
else
{
system.assertequals('Already in Contact', aderror);
}
}
}
-
- Anudeep B
- May 24, 2015
- Like
- 0
- Continue reading or reply
REST API Invalid session or session Expire Error
I am trying to Integrate from one SalesForce to another SalesForce, say SF1(Provider) and SF2(Consumer). I created Connected app and having Consumer key, Consumer Secret and callback URL.
To consume in SF2 i have write this below code.
global class RestTwoStepCall
{
public string result{set;get;}
public void show()
{
Http p = new Http();
HttpRequest request = new HttpRequest();
request.setMethod('POST');
request.setEndPoint('https://login.salesforce.com/services/oauth2/token');
request.setBody('grant_type=password&client_id=Consumer key(Given) &client_secret=Consumer Secret(Given) &username=UserName(Given)&password=PasswordwithSecurityToken');
HttpResponse response = p.send(request);
String resp = response.getBody();
fromJSON js = (fromJSON)JSON.deserialize(resp,fromJSON.class);
result = js.access_token;
HttpRequest req1 = new HttpRequest();
req1.setMethod('GET');
req1.setEndPoint('https://ap2.salesforce.com/services/apexrest/Deepus?name=Anudeep&Dept=IT&job=SFDCDeveloper');
req1.setHeader('Authorization','OAuth '+result);
HttpResponse res = p.send(req1);
result = res.getBody();
}
public class fromJSON
{
public String id;
public String issued_at;
public String token_type;
public String instance_url;
public String signature;
public String access_token;
}
}
by executing this i got this Error on VF page..
[{"message":"Session expired or nvalid","errorCode":"INVALID_SESSION_ID"}]
I have enable api on profile, and did reset security token. where i went wrong.?
To consume in SF2 i have write this below code.
global class RestTwoStepCall
{
public string result{set;get;}
public void show()
{
Http p = new Http();
HttpRequest request = new HttpRequest();
request.setMethod('POST');
request.setEndPoint('https://login.salesforce.com/services/oauth2/token');
request.setBody('grant_type=password&client_id=Consumer key(Given) &client_secret=Consumer Secret(Given) &username=UserName(Given)&password=PasswordwithSecurityToken');
HttpResponse response = p.send(request);
String resp = response.getBody();
fromJSON js = (fromJSON)JSON.deserialize(resp,fromJSON.class);
result = js.access_token;
HttpRequest req1 = new HttpRequest();
req1.setMethod('GET');
req1.setEndPoint('https://ap2.salesforce.com/services/apexrest/Deepus?name=Anudeep&Dept=IT&job=SFDCDeveloper');
req1.setHeader('Authorization','OAuth '+result);
HttpResponse res = p.send(req1);
result = res.getBody();
}
public class fromJSON
{
public String id;
public String issued_at;
public String token_type;
public String instance_url;
public String signature;
public String access_token;
}
}
by executing this i got this Error on VF page..
[{"message":"Session expired or nvalid","errorCode":"INVALID_SESSION_ID"}]
I have enable api on profile, and did reset security token. where i went wrong.?
-
- Anudeep B
- April 18, 2015
- Like
- 0
- Continue reading or reply
JSON.writeObject(); elaboration need
Ihave this JSON :
public class Exinteg {
public string result{get;set;}
public Exinteg()
{
JSONGenerator jg = JSON.CreateGenerator(true);
jg.writestartObject();
jg.writestringfield('Name','Sathish');
jg.writeNumberField('age',30);
jg.writeFieldName('Account');
list<account> acc= [select name,industry from account limit 2];
jg.writeObject(acc); // What processing internally at this line
jg.writeFieldName('myarray');
jg.writestartArray();
jg.writenumber(10);
jg.writenumber(20);
jg.writeEndArray();
jg.writeEndObject();
result=jg.getAsString();
}
}
{ "Name" : "Sathish", "age" : 30, "Account" : [ { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6BAAR" }, "Name" : "Sunkeert", "Id" : "0019000001Epo6BAAR", "Industry" : "Chemical" }, { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6CAAR" }, "Name" : "Samba", "Id" : "0019000001Epo6CAAR", "Industry" : "Chemical" } ], "myarray" : [ 10, 20 ] }
i was fetching only name and industry fields from account but why the other coming to JSON? which i didn't use in SOQL Query (in bold above).
public class Exinteg {
public string result{get;set;}
public Exinteg()
{
JSONGenerator jg = JSON.CreateGenerator(true);
jg.writestartObject();
jg.writestringfield('Name','Sathish');
jg.writeNumberField('age',30);
jg.writeFieldName('Account');
list<account> acc= [select name,industry from account limit 2];
jg.writeObject(acc); // What processing internally at this line
jg.writeFieldName('myarray');
jg.writestartArray();
jg.writenumber(10);
jg.writenumber(20);
jg.writeEndArray();
jg.writeEndObject();
result=jg.getAsString();
}
}
{ "Name" : "Sathish", "age" : 30, "Account" : [ { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6BAAR" }, "Name" : "Sunkeert", "Id" : "0019000001Epo6BAAR", "Industry" : "Chemical" }, { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6CAAR" }, "Name" : "Samba", "Id" : "0019000001Epo6CAAR", "Industry" : "Chemical" } ], "myarray" : [ 10, 20 ] }
i was fetching only name and industry fields from account but why the other coming to JSON? which i didn't use in SOQL Query (in bold above).
-
- Anudeep B
- March 30, 2015
- Like
- 0
- Continue reading or reply
explanation for below JSON serialize and deserialize code.
I have a json which has serialized --> {"make":"Desing","year":2000}
class name is car
string s = '{"make":"Desing","year":2000}';
i want deserialized explanation for below i did
car c =(car)JSON.deserialize(s,car.class);
for the above line what is the responsibilities of these each word --> (car), (s, car.class)
class name is car
string s = '{"make":"Desing","year":2000}';
i want deserialized explanation for below i did
car c =(car)JSON.deserialize(s,car.class);
for the above line what is the responsibilities of these each word --> (car), (s, car.class)
-
- Anudeep B
- March 30, 2015
- Like
- 0
- Continue reading or reply
loops in formula field
User will enter Month field and Lifted amount,
i want to calculate Paid Amount, Due Amount, Payable amount.
i tried with formula fields but i didn't success. Please give me idea how to approch on this scenario
i hope image will give you clarity, if not please post me.
Thanks.
-
- Anudeep B
- February 20, 2015
- Like
- 0
- Continue reading or reply
Need Batch apex clarification on my queries.
I messedup with different answers of batch apex help me on this.
Please correct me below if i go wrong any where.!
/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================
Please give me clarification for below.
* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?
Give me clarification on this points, i am confused on these things, even shortly or with explanation.
Thanks.
Please correct me below if i go wrong any where.!
/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================
Please give me clarification for below.
* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?
Give me clarification on this points, i am confused on these things, even shortly or with explanation.
Thanks.
-
- Anudeep B
- February 14, 2015
- Like
- 0
- Continue reading or reply
Batch Apex issue.
i am trying to execute below code. where updating a site field in account object.
global class Accbtchstate implements database.batchable<sobject>
{
global database.querylocator start(database.batchablecontext bc)
{
string state = 'select id,name from account';
return database.getquerylocator(state);
}
global void execute(database.batchablecontext bc, list<account> scope)
{
list<account> acc = new list<account>();
for(account a:acc)
{
a.Site = 'No nedd';
acc.add(a);
}
update acc;
}
global void finish(database.batchablecontext bc)
{
}
}
executing using this:
1) Accbtchstate BC = new Accbtchstate();
Database.executeBatch(BC,1000);
please identify problem and guide me how to exactly execute a batch apex.
* i tried all the source to execute.
global class Accbtchstate implements database.batchable<sobject>
{
global database.querylocator start(database.batchablecontext bc)
{
string state = 'select id,name from account';
return database.getquerylocator(state);
}
global void execute(database.batchablecontext bc, list<account> scope)
{
list<account> acc = new list<account>();
for(account a:acc)
{
a.Site = 'No nedd';
acc.add(a);
}
update acc;
}
global void finish(database.batchablecontext bc)
{
}
}
executing using this:
1) Accbtchstate BC = new Accbtchstate();
Database.executeBatch(BC,1000);
please identify problem and guide me how to exactly execute a batch apex.
* i tried all the source to execute.
-
- Anudeep B
- February 12, 2015
- Like
- 0
- Continue reading or reply
Restrict the Duplicates to Entering through Dependent Picklist.!
I created a custom Object "Location" , all are 3 picklists and each other dependent picklists hirarchely.

I am getting Duplication entries from these fields.
when i select HeadQuarter there can be multiple Areas should be enter but once i select one Area in one HeadQuarter,
the selected Area should not save again in the record .
To avoid this which criteria should i follow,
Workflow
Validation Rule
Trigger
Which one is suitable and how.
Is there any other Good Apporach .
I am getting Duplication entries from these fields.
when i select HeadQuarter there can be multiple Areas should be enter but once i select one Area in one HeadQuarter,
the selected Area should not save again in the record .
To avoid this which criteria should i follow,
Workflow
Validation Rule
Trigger
Which one is suitable and how.
Is there any other Good Apporach .
-
- Anudeep B
- January 03, 2015
- Like
- 0
- Continue reading or reply
Field_Integrity_Exception
Field_Integrity_Exception
Failed to create createContainerMember for containerId=1dc900000009PrAAAU: This container member belongs to a container that currently has an unfinished save request with deploymentId=1dr90000000yACy. You may not modify any members in this container until it completes.: Metadata Container ID.
I got this Error While I am trying to Execute My Simple Program. What is it mean, and What is solution for it.
Failed to create createContainerMember for containerId=1dc900000009PrAAAU: This container member belongs to a container that currently has an unfinished save request with deploymentId=1dr90000000yACy. You may not modify any members in this container until it completes.: Metadata Container ID.
I got this Error While I am trying to Execute My Simple Program. What is it mean, and What is solution for it.
-
- Anudeep B
- September 16, 2014
- Like
- 0
- Continue reading or reply
Lightning CSS code error while task execution
I am trying to complete the one Lightning task i am getting below CSS error, plz help me on this.

Thanks
Thanks
- Anudeep B
- February 20, 2016
- Like
- 0
- Continue reading or reply
JSON.writeObject(); elaboration need
Ihave this JSON :
public class Exinteg {
public string result{get;set;}
public Exinteg()
{
JSONGenerator jg = JSON.CreateGenerator(true);
jg.writestartObject();
jg.writestringfield('Name','Sathish');
jg.writeNumberField('age',30);
jg.writeFieldName('Account');
list<account> acc= [select name,industry from account limit 2];
jg.writeObject(acc); // What processing internally at this line
jg.writeFieldName('myarray');
jg.writestartArray();
jg.writenumber(10);
jg.writenumber(20);
jg.writeEndArray();
jg.writeEndObject();
result=jg.getAsString();
}
}
{ "Name" : "Sathish", "age" : 30, "Account" : [ { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6BAAR" }, "Name" : "Sunkeert", "Id" : "0019000001Epo6BAAR", "Industry" : "Chemical" }, { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6CAAR" }, "Name" : "Samba", "Id" : "0019000001Epo6CAAR", "Industry" : "Chemical" } ], "myarray" : [ 10, 20 ] }
i was fetching only name and industry fields from account but why the other coming to JSON? which i didn't use in SOQL Query (in bold above).
public class Exinteg {
public string result{get;set;}
public Exinteg()
{
JSONGenerator jg = JSON.CreateGenerator(true);
jg.writestartObject();
jg.writestringfield('Name','Sathish');
jg.writeNumberField('age',30);
jg.writeFieldName('Account');
list<account> acc= [select name,industry from account limit 2];
jg.writeObject(acc); // What processing internally at this line
jg.writeFieldName('myarray');
jg.writestartArray();
jg.writenumber(10);
jg.writenumber(20);
jg.writeEndArray();
jg.writeEndObject();
result=jg.getAsString();
}
}
{ "Name" : "Sathish", "age" : 30, "Account" : [ { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6BAAR" }, "Name" : "Sunkeert", "Id" : "0019000001Epo6BAAR", "Industry" : "Chemical" }, { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6CAAR" }, "Name" : "Samba", "Id" : "0019000001Epo6CAAR", "Industry" : "Chemical" } ], "myarray" : [ 10, 20 ] }
i was fetching only name and industry fields from account but why the other coming to JSON? which i didn't use in SOQL Query (in bold above).
- Anudeep B
- March 30, 2015
- Like
- 0
- Continue reading or reply
Need Batch apex clarification on my queries.
I messedup with different answers of batch apex help me on this.
Please correct me below if i go wrong any where.!
/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================
Please give me clarification for below.
* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?
Give me clarification on this points, i am confused on these things, even shortly or with explanation.
Thanks.
Please correct me below if i go wrong any where.!
/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================
Please give me clarification for below.
* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?
Give me clarification on this points, i am confused on these things, even shortly or with explanation.
Thanks.
- Anudeep B
- February 14, 2015
- Like
- 0
- Continue reading or reply
Batch Apex issue.
i am trying to execute below code. where updating a site field in account object.
global class Accbtchstate implements database.batchable<sobject>
{
global database.querylocator start(database.batchablecontext bc)
{
string state = 'select id,name from account';
return database.getquerylocator(state);
}
global void execute(database.batchablecontext bc, list<account> scope)
{
list<account> acc = new list<account>();
for(account a:acc)
{
a.Site = 'No nedd';
acc.add(a);
}
update acc;
}
global void finish(database.batchablecontext bc)
{
}
}
executing using this:
1) Accbtchstate BC = new Accbtchstate();
Database.executeBatch(BC,1000);
please identify problem and guide me how to exactly execute a batch apex.
* i tried all the source to execute.
global class Accbtchstate implements database.batchable<sobject>
{
global database.querylocator start(database.batchablecontext bc)
{
string state = 'select id,name from account';
return database.getquerylocator(state);
}
global void execute(database.batchablecontext bc, list<account> scope)
{
list<account> acc = new list<account>();
for(account a:acc)
{
a.Site = 'No nedd';
acc.add(a);
}
update acc;
}
global void finish(database.batchablecontext bc)
{
}
}
executing using this:
1) Accbtchstate BC = new Accbtchstate();
Database.executeBatch(BC,1000);
please identify problem and guide me how to exactly execute a batch apex.
* i tried all the source to execute.
- Anudeep B
- February 12, 2015
- Like
- 0
- Continue reading or reply
Alerts & Notifications ?
I just want to know what is exactly mean by Alerts & Notifications and what is the difference between them?
Thanks,
Yogi
Thanks,
Yogi
- Yogii
- February 11, 2015
- Like
- 0
- Continue reading or reply
Restrict the Duplicates to Entering through Dependent Picklist.!
I created a custom Object "Location" , all are 3 picklists and each other dependent picklists hirarchely.

I am getting Duplication entries from these fields.
when i select HeadQuarter there can be multiple Areas should be enter but once i select one Area in one HeadQuarter,
the selected Area should not save again in the record .
To avoid this which criteria should i follow,
Workflow
Validation Rule
Trigger
Which one is suitable and how.
Is there any other Good Apporach .
I am getting Duplication entries from these fields.
when i select HeadQuarter there can be multiple Areas should be enter but once i select one Area in one HeadQuarter,
the selected Area should not save again in the record .
To avoid this which criteria should i follow,
Workflow
Validation Rule
Trigger
Which one is suitable and how.
Is there any other Good Apporach .
- Anudeep B
- January 03, 2015
- Like
- 0
- Continue reading or reply
- Jamie Horstmann
- January 02, 2015
- Like
- 0
- Continue reading or reply
How to run the batch apex class
I made a batch class which fetched and updates objects information, and now I'm wondering should I make a trigger to run the batch class or should I make a scheduler class ? Could you give me an example of a trigger that calls a batch and how to create a scheduler class ? I have been reading about them , but I'm not sure what to do and where to start.
Thanks!
Laaral
- Laaral
- August 13, 2013
- Like
- 0
- Continue reading or reply