• viswada
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 54
    Questions
  • 26
    Replies

HI All,

 

 

                HI ,   I have One internal user "Analyst" , He has all pwrmission on case object. but when   he opening the case record  getting  Error  Like  

 

 

URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com.

You may have reached this page after clicking on a direct link into the application. This direct link might be:
• A bookmark to a particular page, such as a report or view
• A link to a particular page in the Custom Links section of your Home Tab, or a Custom Link
• A link to a particular page in your email templates

If you reached this page through a bookmark, you are probably trying to access something that has moved. Please update your bookmark.

If you reached this page through any of the other direct links listed above, please notify your administrator to update the link.

If you reached this page through a link on our site, please report the broken link directly to our Support Team and we will fix it promptly. Please indicate the page you were on when you clicked the link as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

 

 

 Can  any one  give the solutions  why it is coming

HI all,

 

     I have a issue with  ideastandardsetController and IdeaStandardController .in  my calss  i am  using ideaStandardController and IdaestandardController  ,  while writting test coverage for  these a classes  i am getting error like " Consructed not defined "   i  have activatevated these classes from salesforce, evethough    i am gettin error. how can we resove this issue.

 .

HI all ,

 

            I  have class with standardset controller   and written test class for that Class , I am getting erroe like"  if I pass sc1  i am getting error like   Compile Error: Constructor not defined: [IdeaListController].<Constructor>(ApexPages.StandardSetController) at line 27 column 33 amd  code Coverage 44% .  the standardsetcontroller is not covering , any one would help me

 

public class IdeaListController extends IdeaController {

Integer IdeaCountWhenMerged = 0;
public Idea[] mergeList {
get {
if (mergeList == null){
mergeList = [select Id from Idea where ParentIdeaId!=null];
}
return mergeList;
}
set;
}
public Idea[] ideas;
private static final Integer MAX_NUMBER_OF_IDEAS_PER_PAGE = 20;

public ApexPages.IdeaStandardSetController controller;
public Integer total {get;set;}
public String catName {get;set;}

// Page number variables
public Integer totalNumPages{get;set;}
public Integer numPages { get; set; }

public Boolean View {get;set;}
public Boolean ArcView {get;set;}
public Boolean ProView {get;set;}

public String reqWorkspaceBtnList {get;set;}
public String accessWorkspaceBtnList {get;set;}
public String hasAccesstoWorkspace {get;set;}
public Map<String,Integer> participantsList {get;set;}


public List<Id> accessWorkspaceList {get;set;}

public IdeaListController() {

}

public IdeaListController(ApexPages.IdeaStandardSetController controller) {
this.controller = controller;
accessWorkspaceBtnList = '';
reqWorkspaceBtnList = '';
hasAccesstoWorkspace ='';
accessWorkspaceList = new List<Id>();
participantsList = new Map<String, Integer>();
List<SObject> sobj = [SELECT Id,Status, (SELECT Id FROM Votes WHERE Type = 'Up' LIMIT 51),(SELECT Id,Number_Of_Participants__c from WorkspaceList__r)
FROM Idea WHERE Id IN :controller.getIdeaList() AND Categories != 'DevSummit 2012'];
List<Idea> tempIdeaList = (List<Idea>)sobj;
for(Idea obj: tempIdeaList) {
String mapId = obj.Id;
mapId = mapId.substring(0,15);
if (obj.Votes.size() > 50 && obj.Status == NULL) {
if(obj.WorkspaceList__r.size()==0){
reqWorkspaceBtnList += obj.Id + ',';
}
else{
accessWorkspaceBtnList += obj.Id + ',';
accessWorkspaceList.add(obj.Id);
participantsList.put(mapId,Integer.valueOf(obj.WorkspaceList__r[0].Number_Of_Participants__c));
}
}
else{
if(obj.WorkspaceList__r.size()>0){
accessWorkspaceBtnList += obj.Id + ',';
accessWorkspaceList.add(obj.Id);
participantsList.put(mapId,Integer.valueOf(obj.WorkspaceList__r[0].Number_Of_Participants__c));
}
}
}
List<WorkspaceUser__c> workspaceUserList = [Select WorkspaceList__c, WorkspaceList__r.Idea__c, UserName__c From WorkspaceUser__c where UserName__c = :userinfo.getUserId() and WorkspaceList__r.Idea__c IN :accessWorkspaceList];
for(WorkspaceUser__c wu : workspaceUserList){
hasAccesstoWorkspace += wu.WorkspaceList__r.Idea__c +',';
}

}

public String feedName {
get {
if (feedName == null) {
if (IdeaController.SORT_POPULAR.equals(sortParam)) {
feedName = IdeaFeedController.TYPE_POPULAR;

} else if (IdeaController.SORT_RECENT.equals(sortParam)) {
feedName = IdeaFeedController.TYPE_RECENT;

} else if (IdeaController.SORT_TOP.equals(sortParam)) {
feedName = IdeaFeedController.TYPE_TOP;

} else if (IdeaController.SORT_COMMENTS.equals(sortParam)) {
feedName = IdeaFeedController.TYPE_RECENT_COMMENTS;

} else {
feedName = IdeaFeedController.TYPE_POPULAR;

}
}
return feedName;
}
set;
}

public IdeaWithVote[] ideasWithVotes {
get {
if (ideasWithVotes == null) {
ideasWithVotes = IdeaWithVote.getIdeasWithVotes(getIdeas());


}
return ideasWithVotes;
}
set;
}

public String cat {get;set;}
public Integer catSize {get;set;}

public Idea[] getIdeas() {
if (ideas == null) {
if (controller != null) {
ideas = controller.getIdeaList();

}
}
return ideas;
}


public String getPageName() {
return PAGE_LIST;
}

public Boolean getHasPreviousPage() {
return getPageParamInt() > 1;

}

public Boolean getHasNextPage() {
return (ideas.size() == MAX_NUMBER_OF_IDEAS_PER_PAGE);
}

public Integer getPageNumber(){
return getPageParamInt();
}



//Caluculate total number of pages
public Integer gettotalpages(){
Integer tot;

for(Idea I : mergeList){
IdeaCountWhenMerged++;
}

//counting ideas for each category
if(categoryParam=='ArcGIS Server')
{
tot = getServerIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcGIS Desktop')
{
tot = getDesktopIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcGIS Desktop Extensions')
{
tot = getArcGISDesktopExtensions();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcGIS Engine')
{
tot = getEngineIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcGIS Explorer')
{
tot = getExplorerIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}

else if(categoryParam=='ArcGIS Online')
{
tot = getOnlineIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcLogistics')
{
tot = getArcLogistics();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}

else if(categoryParam=='Geodatabase')
{
tot = getGeoDatabase();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Imagery')
{
tot = getImagery();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Maps and Content')
{
tot = getMaps();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Mobile GIS')
{
tot = getMobilegis();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}

else if(categoryParam=='Business Analyst')
{
tot = getBusinessAnalyst();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Esri CityEngine')
{
tot = getCityEngine();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Other Products')
{
tot = getOtherProducts ();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Web Apps and APIs')
{
tot =getWebApps();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Production Mapping (PLTS)')
{
tot = getProdMap();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Service Ideas')
{
tot = getServiceIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Defense and Intelligence')
{
tot = getDefenseandIntelligence();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Education')
{
tot = getEducation();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Local Government')
{
tot = getLocalGovernment();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Mining')
{
tot = getMining();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Federal Government')
{
tot = getFederalGovernment();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Natural Resources')
{
tot = getNaturalResources();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Petroleum')
{
tot = getPetroleum();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}

else if(categoryParam=='Public Safety')
{
tot = getPublicSafety();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Utilities')
{
tot = getUtilities();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Telecommunications')
{
tot = getTelecommunications();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Transportation')
{
tot = getTransportation();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Other Industries')
{
tot = getOtherIndustries();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Water and Wastewater')
{
tot = getWaterandWastewater();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
/*else if(categoryParam=='EGUG 2010')
{
tot=getEGUG2010();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='DevSummit 2012')
{
tot=getDevSummit();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}*/
else if(categoryParam=='Training Ideas')
{
tot=getTrainingIdeas();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='ArcGIS Runtime')
{
tot=getArcGISRuntime();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else if(categoryParam=='Oceans and Maritime')
{
tot=getOceansMaritime();
totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
}
else
{
totalNumPages = Math.round(Math.ceil((this.controller.getResultSize()-IdeaCountWhenMerged) / ( 1.0 * this.controller.getPageSize())));
//this.controller.getResultSize()
}
return totalNumPages;
}
public String getSort(){
return sortParam;
}

//Do not display the page numbers for comments

public Boolean getcheckSort(){
if(sortParam=='Comments'||statusParam=='Under Consideration'||statusParam=='Implemented'||statusParam=='Deferred')
return false;
else
return true;
}

/* public integer getTest(){
integer intTotal ;

return intTotal;
} */

/*
public string pNUM {get;set;}
public String fullURL;
public String getURL(){
return ApexPages.CurrentPage().getURL();
}
public PageReference goToPage(){
PageReference pageRef = new PageReference(ApexPages.CurrentPage().getURL());
pageRef.getParameters().clear();
pageRef.getParameters().put('p',pNUM);
// pageRef.setRedirect(true);
return pageRef+;
} */

}

 this code not covering ...... How to cover this code  , My  test class is

 

static testMethod void testidealist controller()
{

IdeaTestUtil.setupTest();
TestIdeaController controller = new TestIdeaController();
Community cm=[select id from community];
idea Testideas=new idea(Tags__c='aaaaa',Status_Changed_By__c='bbbb',CommunityId=Cm.id,title='hii');
insert Testideas;
List<Idea> ideas= new List<Idea>();
ideas.add(Testideas);
//IdeaListController Ilc1=New IdeaListController();

ApexPages.StandardsetController sc1= new ApexPages.StandardsetController(Ideas);


IdeaListController Ilc=New IdeaListController() if I pass sc1  i am getting error like   Compile Error: Constructor not defined: [IdeaListController].<Constructor>(ApexPages.StandardSetController) at line 27 column 33

checkFeedName(IdeaController.SORT_POPULAR, IdeaFeedController.TYPE_POPULAR);
checkFeedName(IdeaController.SORT_RECENT, IdeaFeedController.TYPE_RECENT);
checkFeedName(IdeaController.SORT_TOP, IdeaFeedController.TYPE_TOP);
checkFeedName(IdeaController.SORT_COMMENTS, IdeaFeedController.TYPE_RECENT_COMMENTS);
checkFeedName('foo', IdeaFeedController.TYPE_POPULAR);

Ilc.getIdeas();
ILC.getPageNumber();
integer i=integer.valueof(ILC.gettotalpages());
string s= Ilc.getSort();
Boolean b=ILc.getcheckSort();


}

 

any one help tp reslove this proble,

Hi  All,

 

  I have  a class , I have written Test class for that . I am Getting only 54%.   any one help to get &5 %

 

Class

-----------------

public class ideauser {

public list<AggregateResult> lstAr = new list<AggregateResult>();
public list<AggregateResult> lstAr1 = new list<AggregateResult>();
public list<Profile> pid = new list<Profile>();
public List<User> uid = new List<User>();

public ideauser()
{
pid = [select Id from Profile where name = 'Customer Portal Ideas User'];
//pid = [select Id from Profile where name = 'Themes Ideas Portal User'];
uid=[select Id from User where ProfileId IN :pid and LastLoginDate=this_week];
lstAr = [select CreatedBy.CommunityNickname Name, count(Id) Total from idea where CreatedDate=This_Week and CreatedById IN :uid group by CreatedBy.CommunityNickname order by count(Id) DESC limit 3];
lstAr1 = [select CreatedBy.CommunityNickname Name, count(Id) Total from IdeaComment where CreatedDate=This_Week and CreatedById IN :uid group by CreatedBy.CommunityNickname order by Count(Id) DESC limit 3];
}
public list<Ideaclass1> getResultsVotes()
{
list<Ideaclass1> lstResult1 = new list<Ideaclass1>();
for(AggregateResult ar1 : lstAr1)
{
Ideaclass1 objIdeaclass1 = new Ideaclass1(ar1);
lstResult1.add(objIdeaclass1);
}
return lstResult1;
}
public list<Ideaclass> getResults()
{
list<Ideaclass> lstResult = new list<Ideaclass>();
for(AggregateResult ar : lstAr)
{
Ideaclass objIdeaclass = new Ideaclass(ar);
lstResult.add(objIdeaclass);
}
return lstResult;
}

class Ideaclass
{
public Integer Total
{get;set;}
public String Name
{get;set;}

public Ideaclass(AggregateResult ar)
{
Total = (Integer) ar.get('Total');
Name = (String)ar.get('Name');
}
}
class Ideaclass1{
public Integer Total
{get;set;}
public String Name
{get;set;}

public Ideaclass1(AggregateResult ar1)
{
Total = (Integer) ar1.get('Total');
Name = (String)ar1.get('Name');
}

}

}

 

 

test class:

-----------------------

 

@istest

Private class Testideauser{
Private static testMethod void testideauser(){

idea id1=new idea(Tags__c='aaaaa',Status_Changed_By__c='3333',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id1;
idea id2=new idea(Tags__c='bbbbb',Status_Changed_By__c='aaaa',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id2;
idea id3=new idea(Tags__c='ccccc',Status_Changed_By__c='bbbb',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id3;
idea id4=new idea(Tags__c='adddddd',Status_Changed_By__c='rrrrrr',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id4;
idea id5=new idea(Tags__c='ssss',Status_Changed_By__c='zzzzz',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id5;
idea id6=new idea(Tags__c='yyyyy',Status_Changed_By__c='xxxx',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id6;
idea id7=new idea(Tags__c='zzzzzz',Status_Changed_By__c='yyyyy',title='hiidea',CommunityId='09aE00000007RhMIAU');
insert id7;

list<AggregateResult> lstAr = new list<AggregateResult>();
list<AggregateResult> lstAr1 = new list<AggregateResult>();
String Uid =UserInfo.getUserId() ;
lstAr = [select CreatedBy.CommunityNickname Name, count(Id) Total from idea where CreatedDate=This_Week and CreatedById =:uid group by CreatedBy.CommunityNickname order by count(Id) DESC limit 3];
lstAr1 = [select CreatedBy.CommunityNickname Name, count(Id) Total from IdeaComment where CreatedDate=This_Week and CreatedById =:uid group by CreatedBy.CommunityNickname order by Count(Id) DESC limit 3];
ideauser u = new ideauser();
u.getResultsVotes();
u.getResults();


}
}

 

The Red color code is not coveing , please help me

Hi all ,

      

 I  have a class   On User object  , I  have Written Test class for that that class   , I am Gettin  only 51% ,  How can i   improve that above 75%.  Plaease help  me , My  

 

Apex calss:

 

public class IdeaForgotPasswordController extends IdeaController {
public String email {get; set;}

public IdeaForgotPasswordController() {
}

public PageReference forgotPassword() {
if (!isValid()) {
return null;
}

String username = null;
if (email != null && email != '') {
List<User> users = [select username from user where username = :email];
if (users.size() == 1) {
// exact match on username
username = users.get(0).username;
}
else {
users = [select username from user where email = :email];
if (users.size() == 1) {
// exact match on email address
username = users.get(0).username;
}
}
}

if (username == null) {
addErrorMessage('User not found');
return null;
}

boolean success = Site.forgotPassword(username);
if (success) {
PageReference pr = new PageReference(URL_FORGOT_PASSWORD_CONFIRM);
pr.setRedirect(true);
return pr;
}
return null;
}

public boolean isValid() {
boolean valid = true;

if (email == '') {
addErrorMessage('Email address is required.');
valid = false;
}

return valid;
}

private void addErrorMessage(String message) {
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, message);
ApexPages.addMessage(msg);
}

}

 

 

Test  class Fort that Class

------------------------------------

 

@isTest
private clAss IdeaForgotPasswordControllerTest
{
static TestMethod Void TestIdeaForgetpassword()
{

Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
User u = new User(Alias = 'eerer',
EmailEncodingKey='UTF-8', LastName='bbbbb', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id, Email='adityavyas.sf@gmail.com',
TimeZoneSidKey='America/Los_Angeles', UserName='adityavyas.sf@gmail.com');
List<User> users = [select username from user where username = :U.email];

System.runAs(u) {
// The following code runs as user 'u'

System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId()); }

IdeaForgotPasswordController ideaforget= New IdeaForgotPasswordController();
Pagereference page=ideaforget.forgotPassword();

}
}

Hi All

 

    I am Getting problem with  Apex.pages StandardsetController My apex class is 

public class IdeaListController extends IdeaController {

    Integer IdeaCountWhenMerged = 0;
    public Idea[] mergeList {
        get {
            if (mergeList == null){
                mergeList = [select Id from Idea where ParentIdeaId!=null]; 
            }
        return mergeList; 
        }
        set;
    }
    public Idea[] ideas;  
    private static final Integer MAX_NUMBER_OF_IDEAS_PER_PAGE = 20; 

    public ApexPages.IdeaStandardSetController controller;
    public Integer total {get;set;}
    public String catName {get;set;}

    // Page number variables
    public Integer totalNumPages{get;set;}
    public Integer numPages { get; set; }

    public Boolean View {get;set;}
    public Boolean ArcView {get;set;}
    public Boolean ProView {get;set;}

    public String reqWorkspaceBtnList {get;set;}
    public String accessWorkspaceBtnList {get;set;}
    public String hasAccesstoWorkspace {get;set;}
    public Map<String,Integer> participantsList {get;set;}
    
    
    public List<Id> accessWorkspaceList {get;set;}
    
    public IdeaListController() {
        
    }

    public IdeaListController(ApexPages.IdeaStandardSetController controller) {        
        this.controller = controller; 
        accessWorkspaceBtnList = '';
        reqWorkspaceBtnList = '';
        hasAccesstoWorkspace ='';
        accessWorkspaceList = new List<Id>(); 
        participantsList = new Map<String, Integer>();    
        List<SObject> sobj = [SELECT Id,Status, (SELECT Id FROM Votes WHERE Type = 'Up' LIMIT 51),(SELECT Id,Number_Of_Participants__c  from WorkspaceList__r) 
                              FROM Idea WHERE Id IN :controller.getIdeaList() AND Categories != 'DevSummit 2012'];
        List<Idea> tempIdeaList = (List<Idea>)sobj;
        for(Idea obj: tempIdeaList) {
            String mapId = obj.Id;
            mapId = mapId.substring(0,15);              
            if (obj.Votes.size() > 50 && obj.Status == NULL) {                 
                if(obj.WorkspaceList__r.size()==0){
                    reqWorkspaceBtnList += obj.Id + ',';
                }
                else{
                    accessWorkspaceBtnList += obj.Id + ',';
                    accessWorkspaceList.add(obj.Id);                                      
                    participantsList.put(mapId,Integer.valueOf(obj.WorkspaceList__r[0].Number_Of_Participants__c));
                }
            }
            else{
                if(obj.WorkspaceList__r.size()>0){
                    accessWorkspaceBtnList += obj.Id + ',';
                    accessWorkspaceList.add(obj.Id);
                    participantsList.put(mapId,Integer.valueOf(obj.WorkspaceList__r[0].Number_Of_Participants__c));
                }
            }
        }
        List<WorkspaceUser__c> workspaceUserList = [Select WorkspaceList__c, WorkspaceList__r.Idea__c, UserName__c From WorkspaceUser__c where UserName__c = :userinfo.getUserId() and WorkspaceList__r.Idea__c IN :accessWorkspaceList];
        for(WorkspaceUser__c wu : workspaceUserList){
            hasAccesstoWorkspace += wu.WorkspaceList__r.Idea__c +',';
        }
        
    }

    public String feedName {
        get {
            if (feedName == null) {
                if (IdeaController.SORT_POPULAR.equals(sortParam)) {
                    feedName = IdeaFeedController.TYPE_POPULAR;
                    

                } else if (IdeaController.SORT_RECENT.equals(sortParam)) {
                    feedName = IdeaFeedController.TYPE_RECENT;
                  
                } else if (IdeaController.SORT_TOP.equals(sortParam)) {
                    feedName = IdeaFeedController.TYPE_TOP;
                   
                } else if (IdeaController.SORT_COMMENTS.equals(sortParam)) {
                    feedName = IdeaFeedController.TYPE_RECENT_COMMENTS;
                  
                } else {
                    feedName = IdeaFeedController.TYPE_POPULAR;
                 
                }               
            }
            return feedName;
        }
        set;
    }
   /* 
    public IdeaWithVote[] ideasWithVotes {
        get {
            if (ideasWithVotes == null) {
                ideasWithVotes = IdeaWithVote.getIdeasWithVotes(getIdeas());
                
         
            }
            return ideasWithVotes;
        }
        set;
    }
    */
    public String cat {get;set;}
    public Integer catSize {get;set;}
    
    public Idea[] getIdeas() {
        if (ideas == null) { 
            if (controller != null) {
                ideas = controller.getIdeaList();
         
            } 
           }   
        return ideas;
    }
   
      
    public String getPageName() {
        return PAGE_LIST;
    }

   public Boolean getHasPreviousPage() {
        return getPageParamInt() > 1;
       
    }

    public Boolean getHasNextPage() {
       return (ideas.size() == MAX_NUMBER_OF_IDEAS_PER_PAGE);        
    }     
     
     public Integer getPageNumber(){
       return getPageParamInt();
     }
     
   
     
     //Caluculate total number of pages
     public Integer gettotalpages(){
         Integer tot;
         
         for(Idea I : mergeList){
             IdeaCountWhenMerged++;
         }
     
         //counting ideas for each category
          if(categoryParam=='ArcGIS Server')
         {                       
                tot =  getServerIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
         else if(categoryParam=='ArcGIS Desktop')
         {                       
                tot = getDesktopIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='ArcGIS Desktop Extensions')
         {                       
                tot = getArcGISDesktopExtensions();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='ArcGIS Engine')
         {                       
                tot = getEngineIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='ArcGIS Explorer')
         {                       
                tot = getExplorerIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          
          else if(categoryParam=='ArcGIS Online')
         {                       
                tot = getOnlineIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='ArcLogistics')
         {                       
                tot = getArcLogistics();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          
          else if(categoryParam=='Geodatabase')
         {                       
                tot = getGeoDatabase();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Imagery')
         {                       
                tot = getImagery();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Maps and Content')
         {                       
                tot = getMaps();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Mobile GIS')
         {                       
                tot = getMobilegis();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }

          else if(categoryParam=='Business Analyst')
         {                       
                tot = getBusinessAnalyst();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
         else if(categoryParam=='Esri CityEngine')
         {                       
                tot = getCityEngine();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Other Products')
         {                       
                tot = getOtherProducts ();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Web Apps and APIs')
         {                       
                tot =getWebApps();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Production Mapping (PLTS)')
         {                       
                tot = getProdMap();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Service Ideas')
         {                       
                tot = getServiceIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Defense and Intelligence')
         {                       
                tot = getDefenseandIntelligence();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Education')
         {                       
                tot =  getEducation();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Local Government')
         {                       
                tot = getLocalGovernment();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Mining')
         {                       
                tot = getMining();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Federal Government')
         {                       
                tot = getFederalGovernment();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Natural Resources')
         {                       
                tot = getNaturalResources();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
         else if(categoryParam=='Petroleum')
         {                       
                tot = getPetroleum();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }

          else if(categoryParam=='Public Safety')
         {                       
                tot = getPublicSafety();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Utilities')
         {                       
                tot = getUtilities();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
         else if(categoryParam=='Telecommunications')
         {                       
                tot = getTelecommunications();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Transportation')
         {                       
                tot = getTransportation();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Other Industries')
         {                       
                tot = getOtherIndustries();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
          else if(categoryParam=='Water and Wastewater')
         {                       
                tot = getWaterandWastewater();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize()))); 
         }
         /*else if(categoryParam=='EGUG 2010')
         {
                tot=getEGUG2010();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
         }
         else if(categoryParam=='DevSummit 2012')
         {
                tot=getDevSummit();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
         }*/
        else if(categoryParam=='Training Ideas')
         {
                tot=getTrainingIdeas();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
         }
         else if(categoryParam=='ArcGIS Runtime')
         {
                tot=getArcGISRuntime();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
         }
         else if(categoryParam=='Oceans and Maritime')
         {
                tot=getOceansMaritime();
                totalNumPages = Math.round(Math.ceil(tot / ( 1.0 * this.controller.getPageSize())));
         }
         else
         {
                totalNumPages = Math.round(Math.ceil((this.controller.getResultSize()-IdeaCountWhenMerged) / ( 1.0 * this.controller.getPageSize())));    
                 //this.controller.getResultSize() 
         }
         return totalNumPages;
     }
     public String getSort(){
         return sortParam;
     }
     
     //Do not display the page numbers for comments
     
     public Boolean getcheckSort(){
         if(sortParam=='Comments'||statusParam=='Under Consideration'||statusParam=='Implemented'||statusParam=='Deferred')
             return false;
         else
             return true;
     }
      
 /*    public integer getTest(){        
         integer intTotal ;
   
        return intTotal;
     } */
   
   /*     
     public string pNUM {get;set;}
     public String fullURL;
     public String getURL(){
         return ApexPages.CurrentPage().getURL();
     }
     public PageReference goToPage(){
         PageReference pageRef = new PageReference(ApexPages.CurrentPage().getURL());
         pageRef.getParameters().clear();
         pageRef.getParameters().put('p',pNUM);
       //  pageRef.setRedirect(true);
         return pageRef+;     
    }  */
    
}

 

 I ahve written  test class Fo that class 

 

private class IdeaListControllerTest {
static testMethod void testFeedName()
{
Idea Testidea= new idea(Status_Changed_By__c='yyyy',Tags__c='xxxx' );
ApexPages.StandardController sc = new ApexPages.StandardController(Testidea);
IdeaListController Ilc=New IdeaListController();
IdeaListController Ilc1=New IdeaListController(sc);
checkFeedName(IdeaController.SORT_POPULAR, IdeaFeedController.TYPE_POPULAR);
checkFeedName(IdeaController.SORT_RECENT, IdeaFeedController.TYPE_RECENT);
checkFeedName(IdeaController.SORT_TOP, IdeaFeedController.TYPE_TOP);
checkFeedName(IdeaController.SORT_COMMENTS, IdeaFeedController.TYPE_RECENT_COMMENTS);
checkFeedName('foo', IdeaFeedController.TYPE_POPULAR);

Ilc.getIdeas();
ILC.getPageNumber();
ILC.gettotalpages();
Ilc.getSort();
ILc.getcheckSort();
}

 

 

 .   

HI,

 

 Hi have a requirement lilke Convertinh EMail Template Into  XMl File , how to do  it, Can any one send the sample Code

 

 

Thanks

HI all,

 

 

                    I wnat to send private chatter meassge from apex code , pla any one provide sample  apex code  to send private chatter Messages.

HI all,

 

          I am  using  actionPollar tag   , and i set the time inteval  5 secs, so that means for every 5 secs the page is refreshed. 

How can i stop refreshing  after 5 refreshes,  iam using  action pollar in  my vf page

 

vf page:

-------------

<apex:page controller="Records20" sidebar="false" >
<apex:form >
<apex:outputpanel rendered="{!displayRecords}" >

<apex:pageblock Title="Answers the Questions">

<b><apex:outputText value="Your Time Starts Now: {!Timer}:00 Min" id="counter"/></b>
<apex:actionPoller action="{!incrementCounter}" rerender="counter " interval="15"/>
<br/>
<br/>

<apex:pageBlockButtons location="bottom">

<apex:commandButton value="Submit" action="{!saveAnswer}" id="button"/><br/>
</apex:pageBlockButtons>
<apex:repeat value="{!items1}" var="it">
<apex:outputText value="{!it.intSerial}"> </apex:outputText>).&nbsp;<apex:outputText value="{!it.strQuestion}"></apex:outputText>
<apex:SelectRadio value="{!it.answer12}">
<apex:selectoptions value="{!it.itemsWrap}"/>
</apex:SelectRadio><br/>
</apex:repeat>
</apex:pageblock>
</apex:outputpanel>
YOUR RESULT IS:&nbsp;&nbsp;<apex:outputText value="{!intCount}"></apex:outputText>
</apex:form>
</apex:page>

__________

controlle---

 

 

public class Records20{

public Integer Timer;
public boolean displayRecords{set;get;}
public string answer1{set;get;}
public List<selectOption> selItems {get;set;}
public integer intCount{get;set;}
list<wrapperQuestions> objwraplst = new list<wrapperQuestions>();
list<Questiuons__c> ques=new list<Questiuons__c>();


public Records20()
{
Timer=0;
displayRecords=true;
list <Questiuons__c> ret=[SELECT id,Question__c,Answers__c,Correctanswer__c FROM Questiuons__c LIMIT 20 ];
ret = ObjectRandomizer.randomizeList (ret);
integer serial=0;
for(Questiuons__c a :ret )
{
System.debug('aaa'+a);
String s = a.Answers__c;
list<string> st =s.split(',');
wrapperQuestions objWrap = new wrapperQuestions();
objWrap.strQuestion = a.Question__c;
objWrap.correctAnswer=a.Correctanswer__c;
serial=serial+1;
objWrap.intSerial=serial;
selItems = new List<selectOption>();
for(String str:st)
{
selItems.add(new SelectOption(str,str));

objWrap.itemsWrap=selItems;

}

objwraplst.add(objWrap);

}
}

public void saveAnswer()
{
intCount=0;
for(wrapperQuestions objwrap:objwraplst)
{
system.debug('::::::::::::'+objwrap.answer12);
if(objwrap.answer12==objwrap.correctAnswer)
{
//intCount = intCount+1;
intCount++;
displayRecords=false;

}else
displayRecords=false;
}

}

public PageReference incrementCounter() {
if(Timer<=5)
Timer++;
system.debug('@@@@@@@@@@@'+timer);
return null;
}

public Integer getTimer() {
system.debug('!!!!!!!!!!!!!!'+timer);
return Timer;
}
public list<wrapperQuestions> getitems1()
{
return objwraplst;
}


public class wrapperQuestions
{
public string strQuestion{get;set;}
public integer intSerial{get;set;}
public List<selectOption> itemsWrap {get;set;}
public string answer12{set;get;}
public string correctAnswer{set;get;}

}

}

  Any one can help me

Hi all,

 

  my senario is like online exam.   I developed one   vf page for displaying  20 questions(records) from question obeject .  i need to   set  timer  for vf page ,  suppose  i am having   20 questions in vf page . i nedd to set 20 min . after twenty 20 min that visual force page  should not appeared  , i can only show the result. How to set the timer for visual force page  ,plz  any on help me

HI ,

 

        I have  written     apex page  for dispalying     questions random ly   form my custom object  ,   while   runing  iam getting System.NullPointerException: Attempt to de-reference a null object  Class.Records20.: line 20, column 1,  , i check ed with console iam getting values ,  i don't know y it is coming ,  i wll show my apex class and   vf and random number gentation calss.

 

Vf page
--------------------------------
<apex:page controller="Records20" sidebar="false" >
<apex:form >
<apex:pageblock Title="Answers the Questions">
<apex:pageBlockButtons location="bottom">

<apex:commandButton value="Submit" action="{!saveAnswer}"/><br/>
</apex:pageBlockButtons>
<apex:repeat value="{!items1}" var="it">
<apex:outputText value="{!it.intSerial}"> </apex:outputText>).&nbsp;<apex:outputText value="{!it.strQuestion}"></apex:outputText>



<apex:SelectRadio value="{!it.answer12}">
<apex:selectoptions value="{!it.itemsWrap}"/>
</apex:SelectRadio><br/>
</apex:repeat>



</apex:pageblock>
YOUR RESULT IS:&nbsp;&nbsp;<apex:outputText value="{!intCount}"></apex:outputText>
</apex:form>
</apex:page>
--------------------------------------
vf page Controller

public class Records20{

public string answer1{set;get;}
public List<selectOption> selItems {get;set;}
public integer intCount{get;set;}
list<wrapperQuestions> objwraplst = new list<wrapperQuestions>();
list<Questiuons__c> ques=new list<Questiuons__c>();


public Records20()
{
list <Questiuons__c> ret=[SELECT id,Question__c,Answers__c,Correctanswer__c FROM Questiuons__c ];
ret = ObjectRandomizer.randomizeList (ret);
integer serial=0;
for(Questiuons__c a :ret )
{
System.debug('aaa'+a);
String s = a.Answers__c;
list<string> st =s.split(',');-----------  i am gettin  that error here
wrapperQuestions objWrap = new wrapperQuestions();
objWrap.strQuestion = a.Question__c;
objWrap.correctAnswer=a.Correctanswer__c;
serial=serial+1;
objWrap.intSerial=serial;
selItems = new List<selectOption>();
for(String str:st)
{
selItems.add(new SelectOption(str,str));

objWrap.itemsWrap=selItems;

}

objwraplst.add(objWrap);

}
}

public void saveAnswer()
{
intCount=0;
for(wrapperQuestions objwrap:objwraplst)
{
system.debug('::::::::::::'+objwrap.answer12);
if(objwrap.answer12==objwrap.correctAnswer)
{
//intCount = intCount+1;
intCount++;
}
}

}
public list<wrapperQuestions> getitems1()
{
return objwraplst;
}


public class wrapperQuestions
{
public string strQuestion{get;set;}
public integer intSerial{get;set;}
public List<selectOption> itemsWrap {get;set;}
public string answer12{set;get;}
public string correctAnswer{set;get;}

}

}
-------------------------------------------------------------
// Random Number generation
public class ObjectRandomizer {

public static list<Questiuons__c> randomizeList (list<Questiuons__c> Records){

list <Questiuons__c> retList = new list <Questiuons__c>();

while (records.size()>0){
system.debug('++++++' + records.size());
retList.add(records.remove(getRandomInt(records.size())));
}

return retList;
}

public static Integer getRandomInt (Integer num){
Double d = math.random() * num;
return d.intValue();
}

}

  when i  check console iam getting values , console is

3:53:29.055 (55560000)|SYSTEM_METHOD_EXIT|[21]|String.valueOf(Object)
23:53:29.055 (55568000)|HEAP_ALLOCATE|[21]|Bytes:95
23:53:29.055 (55578000)|SYSTEM_METHOD_ENTRY|[21]|System.debug(ANY)
23:53:29.055 (55583000)|USER_DEBUG|[21]|DEBUG|&&&&&&&&&&&&&&(Visible light, Infrared radiation, X-rays and gamma rays, Ultraviolet radiation)
23:53:29.055 (55589000)|SYSTEM_METHOD_EXIT|[21]|System.debug(ANY)
23:53:29.055 (55594000)|STATEMENT_EXECUTE|[23]
23:53:29.060 (60731000)|SYSTEM_METHOD_ENTRY|[19]|System.debug(ANY)
23:53:29.060 (60737000)|USER_DEBUG|[19]|DEBUG|$$$$$$$$$$$Repo rate ,Reverse repo rate,Cash Reserve ratio,base rate
23:53:29.060 (60743000)|SYSTEM_METHOD_EXIT|[19]|System.debug(ANY)
23:53:29.060 (60747000)|STATEMENT_EXECUTE|[20]

  what is the problem , can any one help me

Hi all,

 

     I am  moving  one  apex class from sandbox to production.   it is uploaded succesfully  in sandbox,  when i am  validating   that class in production ,  i  am getting  "system.assertEquals   error", becuase of two test classes in procution, ,I don't have t two test classes in my sandbox to put comments  that lines, what can i do  to resolve this prob, I am using changesets  for deploying , any one can help me 

Hello,
I've configured Live Agent to Work with the Custom Portal without using Sites, but the pre-chat form functionality is not working.  
Problem
The actual behavior is, when the customer clicks on the link to chat with a live agent and the live agent accepts, the customer is immediately able to chat with the live agent. 
Desired Behavior
The expected behavior is, when a customer clicks on a link to chat with a live agent and the live agent accepts the chat, the customer should complete a pre-chat form before proceeding to chat with the live agent. 
Resources
The pre chat form is created using examples provided by salesforce (I used the code in the example verbatim and I also tried using code from Pre-Chat form with some CSS.pdf). The visualforce page renders standalone, but it does not appear when the user clicks on a button.  The visualforce pages are associated with the customer portal user's profile.  I've used the example attached as well as the example in the official live chat developer's guide.  http://www.salesforce.com/us/developer/docs/live_agent_dev/index.htm.  The documentation does not provide enough information to implement the pre-chat form successfully.  
Another member from our team reviewed this issue and did not see where the javascript references the button and also believed the documentation is light.
Does the visualforce page only work with sites?  Is there an existing environment setup where this feature is working?  Do you have any sample pre-chat forms that use html/javascript instead of visualforce pages?
Thank you in advance for your help.  I have a video demonstrating the problem, if that will help  http://www.screencast.com/t/Xgv8EQDb4.

Does anybody know how to test an Idea Extension controller?

 

Salesforce have activated for me the IdeaStandardSetController and IdeaStandardController classes.

 

My code is as follows. The commented out text at the bottom of the test method are the options I have tried.

 

I have reviewed the documentation on Ideas controllers and I see the following;

Instantiation

An IdeaStandardController object cannot be instantiated. An instance can be obtained through a constructor of a custom extension controller when using the standard ideas controller.

 

As you can see from the below, I am using the IdeaStandardController and with that logic based on the above instantiation note I would have presumed my option two (in test method below) would be working.

 

The error message I get is as follow;

Compile Error: Constructor not defined: [ideaExtension].<Constructor>(ApexPages.StandardController) at line 51 column 29 

 

This corresponds to the first line in option 2.

 

public class ideaExtension{

    private final ApexPages.IdeaStandardController ideaController;
    public Idea idea {get;set;}
    public String commentBody{get;set;}
    public Boolean msgCommentPostingSuccess {get;set;}
    public Boolean msgCommentPostingError {get;set;}
    public String msgCommentPostingErrorSummary {get;set;}
    
    public ideaExtension(ApexPages.IdeaStandardController controller) {
        ideaController = (ApexPages.IdeaStandardController)controller;
        idea = (Idea)ideaController.getRecord();
        msgCommentPostingSuccess = false;
        msgCommentPostingError = false;
    }

    public PageReference insertComment(){
        IdeaComment comment = new IdeaComment();
        comment.CommentBody = commentBody;
        comment.IdeaId = idea.Id;
        try {  
            insert comment;
            msgCommentPostingSuccess = true;
        }
        catch(Exception ex) {
            // handle exception code here;
        }
        return null;  
     }
 
     /* TEST DATA METHODS */
     public static Idea createIdea(){
         Idea i = new Idea();
         i.Title = 'New Idea';
         i.body = 'My idea description';
         insert i;
         return i;
     }    
    static testMethod void testNewComment(){
        /* Create the test data */
        Idea testIdea = createIdea();
        
        /* Instatiate controller */

        // not working - Option 1
        //ApexPages.IdeaStandardController stdController = new ApexPages.IdeaStandardController(testIdea);
        //ideaExtension ext = new ideaExtension(stdController);
        
        // not working - Option 2
        //ApexPages.StandardController stdController = new ApexPages.StandardController(testIdea);
        //ideaExtension ext = new ideaExtension(stdController);

        // not working - Option 3
        //ideaExtension ext = new ideaExtension();
        
        /* Make assertions to validate logic */
        
    }   
}