• SK R.ax1448
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 31
    Replies

Hi All,

 

I have a custom button on my VF page  which display all the acitivities, when i clicked on button I am getting the following the error.

 

Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

Click here to return to the previous page.

 

I am a System Admin, even though getting the above error msg. Any help must be appreciated.

 

 

Thanks in advance,

SK

 

Hi All,

I have replaced Activity History related list with a VF page using Standard Controller, the issue is data is not displaying order by, I want to sort the activity histories based on lastModified date/time, how to do that ? any help is highly appreciated.

 

Here is the VF:

 

<apex:page standardController="Case" extensions="ActivityHistory_cls">
 <apex:form >
     <apex:pageBlock title="Activity History" >
        
        <apex:pageBlockTable value="{!Case.ActivityHistories}" var="list" id="theId">
           
            <apex:column headerValue="Subject"><apex:outputField value="{!list.Subject}"/> </apex:column>
            <apex:column headerValue="Name"><apex:outputField value="{!list.WhoId}"/> </apex:column>
            <apex:column headerValue="Task"> <apex:outputField value="{!list.IsTask}"/> </apex:column>
            <apex:column headerValue="Due Date"> <apex:outputField value="{!list.ActivityDate}"/> </apex:column>
            <apex:column headerValue="LastModified Date/Time">  <apex:outputField value="{!list.LastModifiedDate}"/></apex:column>
       </apex:pageblockTable>    
     </apex:pageBlock>
 </apex:form>
</apex:page>

 

Thanks in advance,

SK

Hi All,

 

Is there any ways to remove standard buttons on bottom of the detail page / layout ?. I want to show the standard buttons at the top of the detail page only.  Any help is appreciated.

 

 

Thanks in advance,

SK

Hi All,

 

Can anyone please explain the below

 

1. What is Master-Detail and Lookup relations / Major difference b/w them ?

2. What is the significance/use of Master-Detail and Lookup ?

3. When to use Master-Detail and Lookup ?

 


Thanks a ton in advance !

 

Regards,

SK

 

Hi All,

 

Any one can please explain what is the use/significance of Map(s) in Apex.  And what can do with maps & can not do without maps.

 

Thanks a ton in advance !

 

 

SK.

 

 

Hi All,

 

I'm trying to write a unit test for a trigger test and getting the following error message:

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, InsertCaseTrigger: execution of BeforeInsert caused by: System.QueryException: List has no rows for assignment to SObject.

 

When I use @isTest(SeeAllData=true), i dont see any error messages, but code is not covered 75%.  Why this is heppening ?

 

Can some one help me please.

 

Trigger:

trigger updateCaseSummary on Case(after insert) {
List<Account> accList = new List<Account>();
set<Id> accIds = new set<Id>();
    
    for(Case cs : Trigger.new){
        accIds.add(cs.AccountId);
     }
      
    accList = [ select CaseNum__c from Account where Id in : accIds];
        if(accList.size() > 0) {
                for(Account ac: accList){
                    if( ac.CaseNum__c == null)
                         ac.CaseNum__c = 0;
                      ac.CaseNum__c = ac.CaseNum__c + 1;
                    }
             update accList;
     }

 

Test Class:

 

@isTest
private class updateCaseSummaryTest{

  static testMethod void SummaryTest(){
    Account acc = New Account(Name = 'TestAccount',CaseNum__c = 1);
    insert acc;
    Case cs = New Case(AccountId = acc.Id);
    insert cs;

    Account acc2 = New Account(Name = 'TestAccount2',CaseNum__c =null);
    insert acc2;
    Case cs2 = New Case(AccountId = acc2.Id);
    insert cs2;

   
  }
}

 

 

Thanks a ton in advance!

 

Hi All,

 

I'm not getting minimum of 75% code coverage for the below trigger, covering only 50%. I didnt understand what mistake i did, can some one please help on this. Any help is highly appreciated.

 

Trigger:

trigger updateCaseSummary on Case(after insert) {
List<Account> accList = new List<Account>();
set<Id> accIds = new set<Id>();
    
    for(Case cs : Trigger.new){
        accIds.add(cs.AccountId);
     }
      
    accList = [ select CaseNum__c from Account where Id in : accIds];
        if(accList.size() > 0) {
                for(Account ac: accList){
                    if( ac.CaseNum__c == null)
                         ac.CaseNum__c = 0;
                      ac.CaseNum__c = ac.CaseNum__c + 1;
                    }
             update accList;
     }

 

Test Class:

 

@isTest(SeeAllData=true)
public class updateCaseSummaryTest{

  static testMethod void SummaryTest(){
    Account acc = New Account(Name = 'TestAccount',CaseNum__c = 1);
    insert acc;
    Case cs = New Case(AccountId = acc.Id);
    insert cs;

    if(acc.CaseNum__c == null)
       acc.CaseNum__c = 0;
    acc.CaseNum__c =  acc.CaseNum__c + 1;  
    update acc;
  }
}

 

Thanks in advance!

Hi All,

I need to send a chatter email notifications to a user/s when a case is created on Account he/she follows. Is there any way to send a email notifications when a case is created via configuration?.  Any help is highly appreciated.


Thanks in advance!

SK

Hi All,

I'm new to chatter, I need to send a chatter email notifications to a user/s when a case is created on Account he/she follows. Is there any way to send a email notifications when a case is created via configuration?.

Any help is highly appreciated.


Thanks in advance!

SK


Hi All,

The following Jscript is working as expected. But when i use the script in VF page, its not poping up the  calender date picker. Can anyone help how to use the script in VF page, any help is highly appreciated.

Java Script:

<!doctype html>
<html lang="en">
<head>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
    
    <script type="text/javascript">
        $(function () {
            $("#datepicker").datepicker({ beforeShowDay: allowedDates });
        });

    var currentYear = new Date().getFullYear();

        var _allowedDates = [
    new Date(currentYear, 2, 31).getTime(),
    new Date(currentYear, 5, 30).getTime(),
    new Date(currentYear, 8, 30).getTime(),
    new Date(currentYear, 11, 31).getTime(),
];

function allowedDates(date) {
    date = date.getTime();

    for (i in _allowedDates)
        if (date == _allowedDates[i])
            return [true, ""];

    return [false, ""];
}


    </script>

</head>
<body>
 
<p>Date: <input type="text" id="datepicker" /></p>
 
 
</body>
</html>


VF Page:

<apex:page controller="DatePickerDEmo2">
<head>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
    
    <script type="text/javascript">
        $(function () {
            $("#datepicker").datepicker({ beforeShowDay: allowedDates });
        });

    var currentYear = new Date().getFullYear();

        var _allowedDates = [
    new Date(currentYear, 2, 31).getTime(),
    new Date(currentYear, 5, 30).getTime(),
    new Date(currentYear, 8, 30).getTime(),
    new Date(currentYear, 11, 31).getTime(),
];

function allowedDates(date) {
    date = date.getTime();

    for (i in _allowedDates)
        if (date == _allowedDates[i])
            return [true, ""];

    return [false, ""];
}


    </script>

</head>

<apex:form >
  <apex:pageBlock >

  <apex:pageblockSection >
         <apex:inputText value="{!d_date_str}" id="datepicker" styleClass="JQueryDate"/>

  </apex:pageblockSection>
  </apex:pageBlock>

 
  </apex:form>

</apex:page>

Controller:

public class DatePickerDEmo2 {

 

    public String d_date_str{get;set;}

    public Contact c{get;set;}

    public DatePickerDEmo2()

    {

        c=new Contact();

    }

}

 

Thanks in advance !

 


Regards,

SK

Hi,

I have a custom date field called Currentfiscal__c on a custom object XXX and have custom fiscal years enabled. My requirement is on click, the date that is populated in the calender would be the last date of fiscal quarter instead of current date calender. Could someone give any idea/workaround on how to do this ?. Any help is highly appreciated.

 

 

Thanks in advance

Hi,

 

I'm unable to deploy my trigger, getting below errors as lack of test code coverage.

Failure Message: "line -1, column -1: Previous load of class failed: create_spr_controllertest", Failure Stack Trace: "null"

Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

 

Below in red color is uncovered code. Its urgent , any help must be highly appreciated.

 

Here is the my code

 

Trigger:

 

trigger UpdateAccountID on Account(before update) {

Set<String> enteredValues = New Set<String>();
Set<String> accountids = New Set<String>();

    for(Account acc : trigger.new)
    {
         
       if(acc.AccountHold__c  != null && acc.AccountHold__c != acc.AccountID__c)
       {
          enteredValues.add(acc.AccountHold__c);
       }
    }

    if(!enteredValues.isEmpty())
    {
       UpdateAccountIDController uda = New UpdateAccountIDController();
       accountids = uda.checkUniqueness(enteredValues);
    }

    for(Account a : trigger.new)
    {
        if(!accountids.isEmpty())
        {
            if(!accountids.contains(a.AccountHold__c))
                a.AccountID__c = a.AccountHold__c;
        }
        else
        {
            if(a.AccountHold__c != null)
                a.AccountID__c = a.AccountHold__c;
        }
   
    }
}

 

Controller Class:

 


public class UpdateAccountIDController{

    public Set<String> checkUniqueness(Set<String> enteredValues)
    {
        List<Account> accountRecs = New List<Account>();
        Set<String> accountIds= New Set<String>();
        accountRecs = [SELECT
                        AccountID__c
                FROM
                        Account
                WHERE
                         AccountID__c in : enteredValues];

        for(Account a : accountRecs)
        {
            accountIds.add(a.AccountID__c);
        }
        return accountIds;   
    }
    
    
    static testMethod void testUpdateAccountIDController(){
    
        Set<String> AccIdHold = new Set <String>{'ACCID01','ACCID02', 'ACCID03', 'ACCID04'};
        Set<String> AccountIds = new Set <String>();
        Account acc = new Account(Name='Test Account',AccountID__c = 'DellACCID02');
        insert acc;
        List <Account> accList = [Select AccountID__c from Account where AccountID__c in : AccIdHold];
        for(Account a: accList){
            AccountIds.add(a.AccountID__c);
        }
        UpdateAccountIDController uda = new UpdateAccountIDController();
        uda.checkUniqueness(AccIdHold);
     }   
        
    
}

 

Test Class:

 


@ isTest
private class UpdateAccountIDTriggerTest{
    
  static testMethod void testUpdateAccountIDTrigger(){
 
     Set<String> changedIds = new Set<String>();
     Set<String> accountids = New Set<String>();
     
      Account acc = new Account(Name = 'Test Account',AccountHold__c = 'ACCID02',AccountID__c='ACCID01');
      insert acc;
      acc.AccountHold__c = 'ACCID03';
      update acc;
      changedIds.add(acc.AccountHold__c);
      UpdateAccountIDController uda = New UpdateAccountIDController();
      accountids = uda.checkUniqueness(changedIds);
    }
}

 

Thanks a lot in advance !

 

Regards,

SK

Hi,
I'm working on a update trigger, i.e, whenever Account.TID__c (Text field) is changed && Account.AccID__c (unique,ExternalId Text fields) is null, check all account which have Account.AccId__c != null and Account.TID__c !=Account.AccID__C, if it's true copy the Account.TID__c into the Account.AccID__C.   I'm getting the following error

 

Execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Class.UpdateAccIDController.updateAccID:

 

Any one can help me please ?.

 

Here is my code

trigger UpdateAccID  on Account (after update) {
if ( Trigger.isUpdate ) {
      UpdateAccIDController.updateAccID(trigger.oldMap, trigger.newMap);
  }
 
}


public class UpdateAccIDController{

public static void updateAccID(Map<ID, Account> oldAccts, Map<ID, Account> newAccts){

Map<ID, Account> accounts = new Map<ID, Account>();

  for(Account acc: newAccts.values()){
    Account oldAcc = oldAccts.get(acct.Id);
      if (acc.TID__c!= oldAcc.TID__c && acc.AccId__c == null){

        for(Account accList:[select Id,AccID__c FROM Account WHERE AccID__c !=null]){
   
              if( acc.TID__c != accList.AccID__c){
                   acc.AccID__c = acc.TID__c;
                 }
       
        }

        
      }
    update acc;
          
    }

  }
}

 

Thank a lot .

 

Regards,

SK

Hi All,

 

I have a custom button on my VF page  which display all the acitivities, when i clicked on button I am getting the following the error.

 

Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

Click here to return to the previous page.

 

I am a System Admin, even though getting the above error msg. Any help must be appreciated.

 

 

Thanks in advance,

SK

 

Hi All,

I have replaced Activity History related list with a VF page using Standard Controller, the issue is data is not displaying order by, I want to sort the activity histories based on lastModified date/time, how to do that ? any help is highly appreciated.

 

Here is the VF:

 

<apex:page standardController="Case" extensions="ActivityHistory_cls">
 <apex:form >
     <apex:pageBlock title="Activity History" >
        
        <apex:pageBlockTable value="{!Case.ActivityHistories}" var="list" id="theId">
           
            <apex:column headerValue="Subject"><apex:outputField value="{!list.Subject}"/> </apex:column>
            <apex:column headerValue="Name"><apex:outputField value="{!list.WhoId}"/> </apex:column>
            <apex:column headerValue="Task"> <apex:outputField value="{!list.IsTask}"/> </apex:column>
            <apex:column headerValue="Due Date"> <apex:outputField value="{!list.ActivityDate}"/> </apex:column>
            <apex:column headerValue="LastModified Date/Time">  <apex:outputField value="{!list.LastModifiedDate}"/></apex:column>
       </apex:pageblockTable>    
     </apex:pageBlock>
 </apex:form>
</apex:page>

 

Thanks in advance,

SK

Hi All,

 

Is there any ways to remove standard buttons on bottom of the detail page / layout ?. I want to show the standard buttons at the top of the detail page only.  Any help is appreciated.

 

 

Thanks in advance,

SK

Hi All,

 

Can anyone please explain the below

 

1. What is Master-Detail and Lookup relations / Major difference b/w them ?

2. What is the significance/use of Master-Detail and Lookup ?

3. When to use Master-Detail and Lookup ?

 


Thanks a ton in advance !

 

Regards,

SK

 

Hi All,

 

Any one can please explain what is the use/significance of Map(s) in Apex.  And what can do with maps & can not do without maps.

 

Thanks a ton in advance !

 

 

SK.

 

 

Hi All,

 

I'm trying to write a unit test for a trigger test and getting the following error message:

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, InsertCaseTrigger: execution of BeforeInsert caused by: System.QueryException: List has no rows for assignment to SObject.

 

When I use @isTest(SeeAllData=true), i dont see any error messages, but code is not covered 75%.  Why this is heppening ?

 

Can some one help me please.

 

Trigger:

trigger updateCaseSummary on Case(after insert) {
List<Account> accList = new List<Account>();
set<Id> accIds = new set<Id>();
    
    for(Case cs : Trigger.new){
        accIds.add(cs.AccountId);
     }
      
    accList = [ select CaseNum__c from Account where Id in : accIds];
        if(accList.size() > 0) {
                for(Account ac: accList){
                    if( ac.CaseNum__c == null)
                         ac.CaseNum__c = 0;
                      ac.CaseNum__c = ac.CaseNum__c + 1;
                    }
             update accList;
     }

 

Test Class:

 

@isTest
private class updateCaseSummaryTest{

  static testMethod void SummaryTest(){
    Account acc = New Account(Name = 'TestAccount',CaseNum__c = 1);
    insert acc;
    Case cs = New Case(AccountId = acc.Id);
    insert cs;

    Account acc2 = New Account(Name = 'TestAccount2',CaseNum__c =null);
    insert acc2;
    Case cs2 = New Case(AccountId = acc2.Id);
    insert cs2;

   
  }
}

 

 

Thanks a ton in advance!

 

Hi All,

 

I'm not getting minimum of 75% code coverage for the below trigger, covering only 50%. I didnt understand what mistake i did, can some one please help on this. Any help is highly appreciated.

 

Trigger:

trigger updateCaseSummary on Case(after insert) {
List<Account> accList = new List<Account>();
set<Id> accIds = new set<Id>();
    
    for(Case cs : Trigger.new){
        accIds.add(cs.AccountId);
     }
      
    accList = [ select CaseNum__c from Account where Id in : accIds];
        if(accList.size() > 0) {
                for(Account ac: accList){
                    if( ac.CaseNum__c == null)
                         ac.CaseNum__c = 0;
                      ac.CaseNum__c = ac.CaseNum__c + 1;
                    }
             update accList;
     }

 

Test Class:

 

@isTest(SeeAllData=true)
public class updateCaseSummaryTest{

  static testMethod void SummaryTest(){
    Account acc = New Account(Name = 'TestAccount',CaseNum__c = 1);
    insert acc;
    Case cs = New Case(AccountId = acc.Id);
    insert cs;

    if(acc.CaseNum__c == null)
       acc.CaseNum__c = 0;
    acc.CaseNum__c =  acc.CaseNum__c + 1;  
    update acc;
  }
}

 

Thanks in advance!

Hi All,

I'm new to chatter, I need to send a chatter email notifications to a user/s when a case is created on Account he/she follows. Is there any way to send a email notifications when a case is created via configuration?.

Any help is highly appreciated.


Thanks in advance!

SK

Hi

 

Can we remove the edit and delete button shown in the left side of the salesforce related list?

 

If so can anyone please tell me how to do that.

 

Thanks

 

Finney

  • January 31, 2012
  • Like
  • 0

For the life of me, I cannot get this to work.

 

I have a remoteAction method returning a URL String. I am then trying to use window.open to open that URL.  For some reason, the browser will not launch a new window and open that URL.  I am certain my code is hitting that line.  Below is a generic example of what I am trying to do.

 

mynamespace.mycontroller.getMyURL(inputString, function(result, event){ 
        	if (event.status) {
        		window.open (result);
       	       	}
       	       	, {escape:true});

 

  • December 17, 2011
  • Like
  • 0

Hi,

 

I need to integrate twitter with salesforce. As a inintial step I have authorized the twitter login credentials using OAuth . But  i'm clueless of how to proceed furthur. Any suggestions?

I have a requirement to prevent users from deleting Activity Histories for one standard object only.

 

I've looked and there isn't an option to hide visibility of the "delete" link or set permissions to prevent users from deleting the Activity History.

 

I've also explored the possibility of writing a trigger, but it seems like there isn't an option of creating a trigger on the ActivityHistory object.

 

Any ideas or suggestions?

  • July 17, 2009
  • Like
  • 0