• sadasiva07
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 16
    Replies
Hi Friends,

i have requriment, where i need to dipsaly the record for the current logged in user need to approve on a vf page. 

Please help me here.

Thanks in adavence.

How to know when a user enters a String or Number in a text data type field through Validation Rules.

why Delegated Admin can't edit manager field in User Object.

while running batch apex i getting staus as "Internal salesforce.com error" in the debug log.

 

this is my batch class :

/******************************************************************************************
Name   : AutoArchivingArticles
 
Purpose: Archiving of Articles depend on the Archivedate which is in the "Archive_Date__c" custom field.
         Whcih is going to schedule.
         
********************************************************************************************/


global class AutoArchivingArticles implements Database.Batchable<SObject>{

    
    Public String query='select id from KnowledgeArticleVersion where publishStatus='+'\'online\'' + ' '+'And'+ ' '+'language ='+'\'en_US\'';
    
    global Database.QueryLocator start(Database.BatchableContext BC){       
             
            system.debug('___query__'+query);
            return Database.getQueryLocator('select id from KnowledgeArticleVersion where publishStatus='+'\'online\'' + ' '+'And'+ ' '+'language ='+'\'en_US\'');    
    }  
    
    global void execute(Database.BatchableContext BC, List<sObject> scope){
         system.debug('___query__'+scope);
        List<KnowledgeArticleVersion> kav= (List<KnowledgeArticleVersion>)scope;  
        
        list<ID> kavid= new list<ID>();
        
              
        // List of Type Issues Solutions
        list<Issues_Solutions__kav> KT_IS = new list<Issues_Solutions__kav>();

        // List of Type Newsletter
        list<Newsletter__kav> KT_NL = new list<Newsletter__kav >();
        
        // List of Type Policies Procedures
        list<Policies_Procedures__kav> KT_PP = new list<Policies_Procedures__kav>();
        
        // List of Type Documentation
        list<Documentation__kav> KT_Doc = new list<Documentation__kav>();
        
        // List of Type FAQs
        list<FAQs__kav> KT_FAQ = new list<FAQs__kav>();
        
        // List of Type Installation_Updates
        list<Installation_Updates__kav> KT_IU = new list<Installation_Updates__kav>();
        
        // List of Type News Alerts
        list<News_Alerts__kav> KT_NA = new list<News_Alerts__kav>();
        
        // List of Type System Requirements
        list<System_Requirements__kav> KT_SR = new list<System_Requirements__kav>();
        
        // Placeing the KnowledgeArticleVeriosn ID's into a list
        
        for(KnowledgeArticleVersion K:kav){
            kavid.add(K.id);
        }
        
        Date Current_Date=system.today();   
        KT_IS=[select id,Archive_Date__c,Title,ArticleNumber from Issues_Solutions__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date];
        KT_NL=[select id,Archive_Date__c,Title,ArticleNumber from Newsletter__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        KT_PP=[select id,Archive_Date__c,Title,ArticleNumber from Policies_Procedures__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date];
        KT_Doc=[select id,Archive_Date__c,Title,ArticleNumber from Documentation__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        KT_FAQ=[select id,Archive_Date__c,Title,ArticleNumber from FAQs__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        KT_IU=[select id,Archive_Date__c,Title,ArticleNumber from Installation_Updates__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        KT_NA=[select id,Archive_Date__c,Title,ArticleNumber from News_Alerts__kav  where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        KT_SR=[select id,Archive_Date__c,Title,ArticleNumber from System_Requirements__kav where id IN : kavid and publishStatus='online' And language ='en_US' And Archive_Date__c=:Current_Date ];
        
        
        //Placing the Ariticle numbers into a list
        
        list<String> lArticleNumber= new list<String>();
                
        for(Issues_Solutions__kav k1:KT_IS){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(Newsletter__kav k1:KT_NL){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(Policies_Procedures__kav k1:KT_PP){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(Documentation__kav k1:KT_Doc){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(FAQs__kav k1:KT_FAQ){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(Installation_Updates__kav k1:KT_IU){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(News_Alerts__kav k1:KT_NA){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
        for(System_Requirements__kav k1:KT_SR){
            system.debug('___date chking__'+k1.Archive_Date__c);
            if(k1.Archive_Date__c==system.today()){
                lArticleNumber.add(k1.ArticleNumber);
            }
        }
        
       
        list<KnowledgeArticle>  listknow= new list<KnowledgeArticle> ();
        listknow=[select id,ArticleNumber from KnowledgeArticle where ArticleNumber IN : lArticleNumber ];
        
        
        for(KnowledgeArticle K:listknow){
            Date ScheduleDate= system.today();
            KbManagement.PublishingService.archiveOnlineArticle(K.id,ScheduleDate);
         }
                  
       }
       
       
       global void finish(Database.BatchableContext BC){
       }     
            
}

Hi,

 

When im deploying one premission set with one custom app premission it is not deploying throwing error as :

 


# Deploy Results:
   File Name:    permissionsets/SSR_Holdings_Permission_Set.permissionset
   Full Name:  SSR_Holdings_Permission_Set
   Action:  NO ACTION
   Result:  FAILED
   Problem: Unknown user permission: AllowDeleteDandBCompany

 

Plz Advice

Hi,

 

i have a requirment like after closing a case again that preticula contact send mail to that case, at that time we need to open the case again automatically with out any human interaction.

 

Plz tell me hw it can be one.

In summer release salesforce provide api for knowledge :

 

when i using these methods i getting error as "Invalid method or signature doesn't exsists".

 

This is code which im using in systemlog.

 

KnowledgeArticle  s= new KnowledgeArticle ();
s=[select id from KnowledgeArticle where id='kA6V0000000001d'];
system.debug('__________'+KbManagement.Publishinervice.publishArticle(s));

Hi friends,

 

i want to retrive the Dashboard foldername. plz tell how we can do this by apex coding:-)

i want to customize the Knowledge object like overriding the page, writing the validation ruels etc.

 

i tried it but their is no API avlaiable for that object 

 

please provide your help

 

thanks in advance.

Hi,

 

My informtica Agent was in Inactive status, i tiried to start the service but i getting error like "com.zerog.lax.lax" please provide me the necessary support on this.

 

its some what very critical thing

is governor limits vary between Triggers and Apex classes

Hi,

 

Im implementing one method in controller which is used as extension for a page, in the controller I a method which returns a pagereference.

 

And in the Page I have one JavaScript fiction which displays a alert messages.

 

But here that alert message was not working because first controller methods are executing first so that the js methods in page is not calling,.

 

is their any alternate way to execute the js methods first after that only controller methods.

 

 

We are creating a custom VF page reports that shows last week activities which associated to Accounts.

 

We are facing problem in getting proper test coverage, because we are fetching the Activities on  created date only,

 

But to coverage this portion of code we have create Activities that are belong to last week in our test class, but the field was non writable in salesforce.

 

Is their any alter native way to do this .

 

Thanks in advance.

Hi,

Any Idea how to extract ActivityHistory object data in CSV format.

It is not supported in data loader.
It fulls internal log and gives 'Internal Salesforce.com Error' when tried to extract using Batch apex
It is not supported by BULK api too.
Also cannot directly use into SOQL and has to use in relation with account/contact.

Please share you thoughts/experience. It will help a lot.

Best Regards,

Rahul
When looking for a job in the scheduled jobs - My scheduled job is not showing
When I try to create it (Thinking it got deleted), I get an error message that it is already created?


 
Hello dear community, I'm getting this exception for a query that I have in my class as well as in my test class when I'm trying to run the test class, how can I fix it? : 
myTestMethod
System.QueryException: List has no rows for assignment to SObject
<span unselectable="on" "="" style="font-weight: normal; display: block; padding: 3px 4px; overflow: hidden; margin-left: 0px;">Class.HelperContactTrigger.sendEmail: line 6, column 1 
Class.HelperContactTriggerTestneu.myTestMethod: line 17, column 1


the classes:

public with sharing class HelperContactTrigger {
    //static method
    public static List<Account> sendEmail(List<Account> accounts) {

        //query on template object, is this correct,what might have been the mistake when I'm refering to EmailTemplate?
        EmailTemplate et=[Select id from EmailTemplate where name= 'Sales: New Customer Email' limit 1];

        //list of emails
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();

        //loop
        for(Account con : accounts){
        .............
        //send mail
        Messaging.sendEmail(emails);

        return accounts;
    }
}

@isTest(SeeAllData=true)
private class HelperContactTriggerTestneu {
public static testMethod void myTestMethod() {

        system.debug('### NewAccountTest ###');
        Account acc = new Account(Name = 'Test Test');
        {
        insert acc;
                        // Here I'm refering to the test account that I have in my accounts, still this does not seem to work, how is that possible?
        List<Account> sendMail = [select id from account where (Name='Test Test') and id=:acc.id];
        
        test.startTest();

        HelperContactTrigger.sendEmail(sendMail);
        test.stopTest();
        System.assert(acc !=null);
        }
        }
        }

thanks in advance! :)
i have a custom feilds called product codes on opportunity.Whenever opportunity product is added to Opportunity,'Product Codes' field value should be appended with the product code of that opportunity product. 


how to implement this through triggers,please help me out
global with sharing class SchedularForBatchApex implements Schedulable {
        
        global void execute(SchedulableContext sc) {
            myBatchClass d = new myBatchClass();
              database.executebatch(d, 10);
        }
        
         Public static void SchedulerMethod(){
             SchedularForBatchApex s = new SchedularForBatchApex();
             string con_exp= '0 0 * * * ?';
             System.schedule('myBatchClass', con_exp, s);
         }
               
 }

why Delegated Admin can't edit manager field in User Object.

Hi,

 

When im deploying one premission set with one custom app premission it is not deploying throwing error as :

 


# Deploy Results:
   File Name:    permissionsets/SSR_Holdings_Permission_Set.permissionset
   Full Name:  SSR_Holdings_Permission_Set
   Action:  NO ACTION
   Result:  FAILED
   Problem: Unknown user permission: AllowDeleteDandBCompany

 

Plz Advice

Hi friends,

 

i want to retrive the Dashboard foldername. plz tell how we can do this by apex coding:-)

Hi,

   I have created a Apex class from an External Web service using WSDL. 

 

While deploying this class  to server I am getting an error :

"Average test coverage across all Apex Classes and Triggers is 60%, at least 75% test coverage is required".


As per Apex document  I had written a test function. But I am still getting this error. 

 

 I am new to salesforce integration, please help me to deploy this Apex class to Server.

 

Thanks

  • April 24, 2012
  • Like
  • 0

Hi,

 

My informtica Agent was in Inactive status, i tiried to start the service but i getting error like "com.zerog.lax.lax" please provide me the necessary support on this.

 

its some what very critical thing

Hi,

Kindly let me know how to create a set up menu in visual force?

 

Thanks,

Eswar.

I just added a NameSpace to my Developer org, and now 2 tests fail with an awful error message.  I'm tempted to just remove the tests so I can actually upload the package.

 

The code hasn't changed, and tests still pass in installed orgs that have the unmanaged package.

 

Error debug lines:

 

21:18:53.48|USER_DEBUG|[7,9]|DEBUG|query string: Select Id, recordId__c FROM chttrunfollow__UnfollowQueue__c WHERE scheduledUnfollowDate__c<= TODAY AND IsDeleted=FALSE
21:18:53.48|METHOD_EXIT|[7,9]|system.debug(String)
21:18:53.48|METHOD_ENTRY|[8,52]|database.query(String)
21:18:53.48|SOQL_EXECUTE_BEGIN|[8,52]|Aggregations:0|Select Id, recordId__c FROM chttrunfollow__UnfollowQueue__c WHERE scheduledUnfollowDate__c<= TODAY AND IsDeleted=FALSE
21:18:53.51|SOQL_EXECUTE_END|[8,52]|Rows:3
21:18:53.51|METHOD_EXIT|[8,52]|database.query(String)
21:18:53.51|METHOD_ENTRY|[9,9]|system.debug(String)
21:18:53.51|METHOD_ENTRY|[9,31]|LIST<chttrunfollow__UnfollowQueue__c>.size()
21:18:53.52|METHOD_EXIT|[9,31]|LIST<chttrunfollow__UnfollowQueue__c>.size()
21:18:53.52|USER_DEBUG|[9,9]|DEBUG|size: 3
21:18:53.52|METHOD_EXIT|[9,9]|system.debug(String)
21:18:53.52|METHOD_ENTRY|[10,16]|Database.getQueryLocator(String)
21:18:53.52|SOQL_EXECUTE_BEGIN|[10,16]|Aggregations:0|Select Id, recordId__c FROM chttrunfollow__UnfollowQueue__c
21:18:53.77|SOQL_EXECUTE_END|[10,16]|Rows:3
21:18:53.77|METHOD_EXIT|[10,16]|Database.getQueryLocator(String)
21:18:53.105|FATAL_ERROR|Internal Salesforce.com Error

 I saw this thread, and added my namespace, but no luck:

http://community.salesforce.com/t5/Visualforce-Development/Visualforce-An-internal-server-error-has-occurred/m-p/167376

 

Class that produces the above error:

 

global with sharing class UnfollowProcessUnfollowQueueBatch implements Database.Batchable<sObject>{

   global String sObjectQuery ='Select Id, recordId__c FROM chttrunfollow__UnfollowQueue__c WHERE scheduledUnfollowDate__c<= TODAY' ;
   
   global Database.QueryLocator start(Database.BatchableContext BC){
        system.debug('query string: '+sObjectQuery);
        List<chttrunfollow__UnfollowQueue__c> uq = database.query(sObjectQuery);
        system.debug('size: '+uq.size());
        return Database.getQueryLocator(sObjectQuery);
   }

   global void execute(Database.BatchableContext BC, List<sObject> scope){
        Set<Id> recordIds=new Set<Id>();
  
        for(sObject s : scope){
            recordIds.add(String.ValueOf(s.get('recordId__c')));
        }//for
    
        //This is the method that unfollows all people from the records 
        try{
            UnfollowRecords.UnfollowRecordsButtonAction(recordIds);
            delete scope;
        } catch (Exception e) {
        }//try
   }

   global void finish(Database.BatchableContext BC){
       AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email from AsyncApexJob where Id =:BC.getJobId()];
  }

}//UnfollowRecordsFromDelayQueueBatch

Other Class that calls this class:

 

global with sharing class unfollowTryBatchJobsAgain{

    public static void unfollowTryBatchJobsAgain(){
        Integer numBatchApexJobsLimit=5;//at time of coding, there are at most 5 concurrent batch apex jobs in any org
        List<AsyncApexJob> numBatchJobs = [SELECT Id, Status FROM AsyncApexJob WHERE Status = 'Queued' OR Status = 'Processing'];

        //This is the number of jobs that can be queued up by this method
        Integer numJobsAvailable=numBatchApexJobsLimit - numBatchJobs.size();

        if(numJobsAvailable>0){
            List<UnfollowBatchJobsQueue__c> batchJobsQueued=[SELECT Id, IsDeleted, delayJob__c, delayRulesIncluded__c, evalateEachRecordForDaysDelay__c, numRulesUsedInThisObject__c, objectName__c, sObjectQuery__c FROM UnfollowBatchJobsQueue__c WHERE IsDeleted=FALSE ORDER BY  CreatedDate ASC];
            //Goal here is to process the delay queue first as it's more important than the others. Rather than do 2 queries, it's handled with variables here:
            Integer delayJobNum=1000;//initialize to huge number as a backup
            for (Integer i=0;i<batchJobsQueued.size();i++){
                if (batchJobsQueued[i].delayJob__c==TRUE){
                    delayJobNum=i;
                    break;
                }//if 2
            }//for 1
            
            for(Integer i=0; i<numJobsAvailable && i<batchJobsQueued.size(); i++){
                //if this is the high priority "delayed records scheduled for unfollow today" job, do it first
                if (delayJobNum!=1000){
                    UnfollowProcessUnfollowQueueBatch unfollowDelayedRecords= new UnfollowProcessUnfollowQueueBatch();
                    unfollowDelayedRecords.sObjectQuery=batchJobsQueued[delayJobNum].sObjectQuery__c;
                    try{
                        Id unfollowRulesProcessId = Database.executeBatch(unfollowDelayedRecords, 200); 
                        delete batchJobsQueued[delayJobNum];
                    } catch(exception e){
//                        system.debug('Either the batch failed or the job deletion from teh queue failed: '+e);
                    }//try
                } else if(batchJobsQueued[i].delayRulesIncluded__c==FALSE){
                 //is this the simple case with no "days delay" rules?
                    UnfollowRecordsBatch  unfollowRecords= new UnfollowRecordsBatch();
                    unfollowRecords.ObjectName=batchJobsQueued[i].objectName__c;
                    unfollowRecords.numRulesUsedInThisObject=batchJobsQueued[i].numRulesUsedInThisObject__c.intValue();
                    unfollowRecords.sObjectQuery =  batchJobsQueued[i].sObjectQuery__c;
                
                    try{
                        Id unfollowRulesProcessId = Database.executeBatch(unfollowRecords, 200); 
                        delete batchJobsQueued[i];
                    } catch(exception e){
//                        system.debug('Either the batch failed or the job deletion from the queue failed: '+e);
                    }//try
                } else {
                //else it's the more complex case where we need to check for the unfollow date
                    UnfollowQueueDelayRecordsBatch queueDelayRecords= new UnfollowQueueDelayRecordsBatch();
                    queueDelayRecords.ObjectName=batchJobsQueued[i].objectName__c;
                    queueDelayRecords.sObjectQuery =  batchJobsQueued[i].sObjectQuery__c;
                    queueDelayRecords.evalateEachRecordForDaysDelay=batchJobsQueued[i].evalateEachRecordForDaysDelay__c;
                    if(queueDelayRecords.evalateEachRecordForDaysDelay==TRUE){
//let's cross our fingers that the rule criteria didn't change between when this job first ran and now :(  
//Will the code fail elegantly if the rules were changed?
//I'd rather not create a 3rd queue just to save the state of the rules due to stupid batch apex limits
                        queueDelayRecords.delayRules=[Select Id, ObjectName__c, Active__c, FieldName__c, FieldType__c, Operator__c, Value__c, DaysDelay__c FROM UnfollowRule__c WHERE DaysDelay__c>0 AND Active__c = TRUE AND objectName__c=:queueDelayRecords.ObjectName]; 
                    }//if 3

                    try{
                        Id unfollowRulesProcessId = Database.executeBatch(queueDelayRecords, 200); 
                        delete batchJobsQueued[i];
                    } catch(exception e){
//                        system.debug('Either the batch failed or the job deletion from the queue failed: '+e);
                    }//try
                }//if 2
            }//for 1
        }//if 1
        
/*                        
        //This will store the job definition for the jobs over the numBatchApexJobsLimit to be run later
        List<UnfollowBatchJobsQueue__c> batchJobsQueued=new List<UnfollowBatchJobsQueue__c>();

        List<UnfollowRule__c> activeNonDelayedRules=[Select Id, ObjectName__c, Active__c, FieldName__c, FieldType__c, Operator__c, Value__c, DaysDelay__c FROM UnfollowRule__c WHERE (DaysDelay__c<1 OR DaysDelay__c=null) AND Active__c = TRUE];
        
        //now count the # rules for each object to pass into the email later
        For (UnfollowRule__c rule:activeNonDelayedRules){
            List<UnfollowRule__c> rules=new List<UnfollowRule__c>();
            if(objectRulesMap.containsKey(rule.ObjectName__c)){
                //get the existing rules in the map & add the new one
                rules=objectRulesMap.get(rule.ObjectName__c);
                rules.add(rule);
                objectRulesMap.remove(rule.ObjectName__c);
                objectRulesMap.put(rule.ObjectName__c, rules);
            } else {
                rules.add(rule);
                objectRulesMap.put(rule.ObjectName__c,rules);
            }//if 1
        }//for 1

        //Now queue up all the batch jobs
        for (String objectName:objectRulesMap.keyset()){
            //First check if there's a slot available - max of 5 concurrent jobs across all apps
            addFieldNames=FALSE;            
            query=buildQuery(objectName, objectRulesMap.get(objectName), addFieldNames);
            if(numJobsAvailable>0){
                numJobsAvailable--;//subtract one from the limit
                UnfollowRecordsBatch  unfollowRecords= new UnfollowRecordsBatch();
                unfollowRecords.ObjectName=objectName;
    
                unfollowRecords.numRulesUsedInThisObject=objectRulesMap.get(objectName).size();
                unfollowRecords.sObjectQuery =  query;
//                system.debug('The sObjectQuery string is: '+unfollowRecords.sObjectQuery);
                
                Id unfollowRulesProcessId = Database.executeBatch(unfollowRecords, 200); 
            }else{
                String sObjectQuery = query;
//                system.debug('There are 5 batch jobs already running, so this job is not scheduled.  Delay Job: TRUE, Object: '+objectName+', # Rules: '+objectRulesMap.get(objectName).size()+', Query: '+sObjectQuery );
                UnfollowBatchJobsQueue__c job=new UnfollowBatchJobsQueue__c(delayJob__c=FALSE, delayRulesIncluded__c=FALSE, objectName__c=objectName, numRulesUsedInThisObject__c=objectRulesMap.get(objectName).size(), sObjectQuery__c=sObjectQuery);
                batchJobsQueued.add(job);
            }//if 1
        }//for 1
        try{
            if(batchJobsQueued.size()>0){
                insert batchJobsQueued;
            }//if 1
        }catch (DMLException e){
//            system.debug('The batch jobs were not added to the queue successfully, likely due to dupe object name.  Error: '+e);
        }//try
*/        
    }//unfollowTryBatchJobsAgain
}//unfollowTryBatchJobsAgain

 

 

 

 

I have created a custom object called PTO. I have also created an approval process for it.  How can I create a  trigger so that it automically executed the approval process i have setup as soon as a new PTO record is created(inserted).  This would behave the same way as if I manually pressed the submit approval button.

 

trigger PTO_Trigger on PTO__c (after insert) 
{
for(PTO__c pto: [select id from pto__c])
{
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setObjectId(pto.id);
}
}

 

 

 

Message Edited by bikla78 on 07-15-2009 11:49 PM