• rathi007
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 5
    Replies
I want to merge two account based on Last Modified Date throw apex

but i am getting some error 

"System.DmlException: Merge failed. First exception on row 0 with id 0019000001ATaTOAA1; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: LastModifiedDate. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [LastModifiedDate]"

I want to open cash drawer on a click in Visual force page.
if any one have link for the same . please share it or any useful doc.

i am waiting a quick response to go ahead .

Hi Guys,

When I click on a Custom button in list view its getting "Insufficient Privileges" error only some time .

In this button i am calling a VF page .

I am waiting for a quick response to go ahead.


Hi guys,

Someone Please suggest me a good Apps for scaning  barcode which shows the value in my vf page.

Please reply ASAP. Looking ahead for an quick responce

Thanks,
Ranveer Rathi

i want to oveerride new button

public class overrideclass {
public overrideclass(ApexPages.StandardController controller) {

}

public pagereference myAction()
{
Integer dd = date.Today().day();
Integer mm = date.Today().month();
Integer yyyy = date.Today().year();
String st=mm+'/'+dd+'/'+yyyy;
pagereference pf =new pagereference ('/a10/e?00Nf0000000HlEX='+st+'&00Nf0000000HlG3='+st+'&00Nf0000000HlF5='+st);
return pf;
}

}

 

 

 

not return create record

Review all error messages below to correct your data.
Apex trigger Count_Opp caused an unexpected exception, contact your administrator: Count_Opp: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0019000000Qeiu4AAB; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Count_Opp: maximum trigger depth exceeded Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4] Account trigger event AfterUpdate for [0019000000Qeiu4]: []: Trigger.Count_Opp: line 42, column 1

 

 

trigger Count_Opp on Account (After  insert, after update) {
list<opportunity> opplist=new list<opportunity>();
list<Account> acclist=new list<account>();
list<Account> acclist1=new list<account>();
set<id> id =new set<id>();
integer won=0;
integer lost=0;
integer total=0;

for(Account a:Trigger.new)
{
id.add(a.id);
}
opplist=[select StageName,name from opportunity where Accountid in:id];

for(opportunity opp:opplist)
{
if(opp.StageName=='Closed Won'&&opp.name!=null)
{
won++;
total++;
}else if(opp.StageName=='Closed Lost'&&opp.name!=null)
{
lost++;
total++;
}
else{
total++;
}
}
acclist=[select No_of_won_opp__c,No_of_lost_opp__c,Total_opp__c from Account where id in:id];


for(Account acc:acclist)
{
acc.No_of_won_opp__c=won;
acc.No_of_lost_opp__c=lost;
acc.Total_opp__c=total;
acclist1.add(acc);
}
if(acclist.size()!=0){
update acclist1;
}
}

 

 

 

 

 

 

 

trigger Count_Opp on Account (After insert, after update) {
list<opportunity> opplist=new list<opportunity>();
list<Account> acclist=new list<account>();
list<Account> acclist1=new list<account>();
set<id> id ;
integer won=0;
integer lost=0;
integer total=0;
for(Account a:Trigger.new)
{
id.add(a.id);
}
opplist=[select StageName,name from opportunity where Accountid=:id];
for(opportunity opp:opplist)
{
if(opp.StageName=='Closed Won'&&opp.name!=null)
{
won++;
total++;
}else if(opp.StageName=='Closed Lost'&&opp.name!=null)
{
lost++;
total++;
}
else{
total++;
}
}
acclist=[select No_of_won_opp__c,No_of_lost_opp__c,Total_opp__c from Account where id=:id];
for(Account acc:acclist)
{
acc.No_of_won_opp__c=won;
acc.No_of_lost_opp__c=lost;
acc.Total_opp__c=total;
acclist1.add(acc);
}
update acclist1;
}

my trigger 

// create a trigger on feeditem to update a account field when found '#' in post
trigger CheckChatterPostsOnAccount on FeedItem (After insert)
{

//create a account list
list<account> acclist = new list<account>();

// create a account list
list<account> acclist2 = new list<account>();

// create a set of id
set<id> s = new set<id>();

// insert a new post
for (FeedItem f: trigger.new)
{

// vrifie the condition
if (f.Body.contains('#' ))
{
String parentId = f.parentId;

// add ids in set
s.add(parentId);
}
}
// stote the check__c value from Accounts in list
acclist =[select id,test_check__c from Account where id in:s];

// Iteration of acclist
for(account acc:acclist)
{

// change the status of checkbox
acc.test_check__c =true;
acclist2.add(acc);
}

// update the status
update acclist2;
for(account acc1:acclist)
{
String st=acc1.id;
Refreshclass rc = new Refreshclass();
rc.refresh(st);
}
}

 

and class................................................................................

global class Refreshclass
{
public PageReference refresh(String idd)
{
System.debug(idd);
PageReference pr=new PageReference('https://ap1.salesforce.com/0019000000TSwxo');
System.debug(pr);
return pr;
}
}

trigger CheckChatterPostsOnAccount on FeedItem (After insert) {
//Get the key prefix for the Account object via a describe call.
String oppKeyPrefix = Account.sObjectType.getDescribe().getKeyPrefix() ;
for (FeedItem f: trigger.new)
{
String parentId = f.parentId;
System.debug(oppKeyPrefix);
System.debug(parentId.startsWith(oppKeyPrefix)&& f.Body.contains('#' ));
//We compare the start of the 'parentID' field to the Account key prefix to
//restrict the trigger to act on posts made to the Account object.
if (parentId.startsWith(oppKeyPrefix)&& f.Body.contains('#' ))
{
// Account a=new Account();
Account a=[select name,test_check__c from Account where id =:parentId];
system.debug(a.test_check__c );
a.test_check__c =true;
system.debug(a.test_check__c );
update a;
}
}
}

i wand to convert a number like 120 to one Hundred Twenty.

but i dont want to  use javascript in my apexcode to print any number.

please help me as soon as posible.

I am trying to grab the date value from a custom Object and use that value to date range another query. Here is my code:

 

Date startDate = Date.valueof([Select startdate__c From Custom__c ]);

 

I do use a where clause to return just one value. StartDate__c is a date field on the Object.

 

This is then used in the following query:

 

Select OpportunityId From Opportunity Where Opportunity.CloseDate >= :startDate 

 

I get the following error:  Invalid date: common.apex.runtime.impl.SObjectList

 

any help?

 

 

i want to oveerride new button

public class overrideclass {
public overrideclass(ApexPages.StandardController controller) {

}

public pagereference myAction()
{
Integer dd = date.Today().day();
Integer mm = date.Today().month();
Integer yyyy = date.Today().year();
String st=mm+'/'+dd+'/'+yyyy;
pagereference pf =new pagereference ('/a10/e?00Nf0000000HlEX='+st+'&00Nf0000000HlG3='+st+'&00Nf0000000HlF5='+st);
return pf;
}

}

 

 

 

not return create record

my trigger 

// create a trigger on feeditem to update a account field when found '#' in post
trigger CheckChatterPostsOnAccount on FeedItem (After insert)
{

//create a account list
list<account> acclist = new list<account>();

// create a account list
list<account> acclist2 = new list<account>();

// create a set of id
set<id> s = new set<id>();

// insert a new post
for (FeedItem f: trigger.new)
{

// vrifie the condition
if (f.Body.contains('#' ))
{
String parentId = f.parentId;

// add ids in set
s.add(parentId);
}
}
// stote the check__c value from Accounts in list
acclist =[select id,test_check__c from Account where id in:s];

// Iteration of acclist
for(account acc:acclist)
{

// change the status of checkbox
acc.test_check__c =true;
acclist2.add(acc);
}

// update the status
update acclist2;
for(account acc1:acclist)
{
String st=acc1.id;
Refreshclass rc = new Refreshclass();
rc.refresh(st);
}
}

 

and class................................................................................

global class Refreshclass
{
public PageReference refresh(String idd)
{
System.debug(idd);
PageReference pr=new PageReference('https://ap1.salesforce.com/0019000000TSwxo');
System.debug(pr);
return pr;
}
}