• z_harika88
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi,

We have created a batch apex which updates the published articles.While running the code,we have gone through the following issue:
We have some published articles that are scheduled for archiving.If we run the code for these kind of articles,then automatically the scheduled date is cancelled.
We didn't find any field in knowledge object to get the scheduled archival date.

I would like to know are there any workaround to get the information of articles that are scheduled for archiving.
Please suggest the way to retrieve the information either in Apex or in SOQL.

Thanks,
Harika.

I am trying to create a professional PDF document using standard APEX and HTML properties to create my content.

I am facing issue with the word-wrap property of CSS as it is misbehaving.

 

Let me explain

I am trying to display the contents of a field in a table (around 7 columns) and render it as pdf. Regardless of what I try, i cannot get the word-wrap to break the word so that the text does not go beyond the container.

 

Here is the code

<table class="tableStyle" >
<thead>
<tr>
<th width="5%" style="color:#FFFFFF;" align="center"><div id="inner">#</div></th>
<th width="30%" style="color:#FFFFFF;"><div id="inner">Field</div></th>
<th width="15%" style="color:#FFFFFF;"><div id="inner">Type</div></th>
<th width="30%" style="color:#FFFFFF;"><div id="inner">Values</div></th>
<th width="10%" style="color:#FFFFFF;"><div id="inner">Default Value</div></th>
<th width="10%" style="color:#FFFFFF;" align="center"><div id="inner">Track History</div></th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!customObject.fields}" var="field">
<tr>
<td width="5%" align="center"><div id="inner">{!FLOOR(count)}</div></td>
<td width="30%"><div id="inner">{!field.label} ({!field.fullName})</div></td>
<td width="15%"><div id="inner">{!field.type}</div></td>
<td width="30%">
<div id="inner">
<apex:repeat value="{!field.values}" var="value">
{!value}<BR/>
</apex:repeat>
</div>
</td>
<td width="10%"><div id="inner">{!field.defaultValue}</div></td>
<td width="10%" align="center">
<div id="inner">
<apex:image value="{!URLFOR($Resource.DesignDocument, IF(field.trackHistory, 'images/checkbox/checkbox_checked.gif', 'images/checkbox/checkbox_unchecked.gif'))}"/>
</div>
</td>
<apex:variable var="count" value="{!count+ 1}"/>
</tr>
</apex:repeat>
</tbody>
</table>

 

and here is the css
table.tableStyle {
width: 100%;
border-collapse: collapse;
background-color: white;
cellpadding:0.5em;
table-layout: fixed;
}
#inner {
border-width: 0em;
margin: 0em;
word-wrap: break-word;
overflow: inherit;
}
td, tr, th{
font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color:#000000;
align: left;
vertical-align: top;
word-wrap: break-word;
overflow:hidden;
}

 

Here is the kicker -
When I render this table in visualforce as pdf, the content overflows and gets clipped (due to overflow:hidden) if i dont specify the overflow:hidden property, it spills over in the next <td> block

 

But when i take the renderas pdf away from the page, the content wraps properly. Could you tell me how to resolve this issue?

Hi,

 

I am trying to download a pdf report and able to do that using renderAs pdf in <apex:page>.

 

However, in the pdf downloaded some of the content in a line which goes beyond the pdf page length is missing.

I tried by including the word-break and break-wrod css styles for the content and still I am unable to resolve the issue.

 

Could anyone help me regarding this.

  • April 05, 2012
  • Like
  • 0
 
<knowledge:articleList articleVar="article"  	        				  
hasMoreVar="hasMore" pageSize="10" articleTypes="Samples_and_Demos__kav, How_To__kav" categories="Topic:Applications,Topic:Desktop">

 I'm trying to specify more then one articleType and category as filters for the VF tag "articleList".

 

The documentation doesn't specify how to do this.

 

For ArticleType, seperating by a comma works fine as listed. If I do the same thing for "categories", I only get results from the 2nd category specified, instead of from both. In this example, I only get results from Topic:Desktop and not Topic:Applications

 

Is there a different syntax for specifying multiple categories or is this a bug?

 

thanks!

Hi Guys

      How to run a JavaScript After the 'contact Detail' page Load . Any sample or link to refer would help .

 

 

Thanks

Saran

 

We're interested in automating the article assignment process via Apex.

 

How can we access the "Assigned To" and "Assigned By" fields (if they are fields) for articles in a draft status? We can't see these fields on the KAV object, or really anywhere in the ERD (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guidelines_knowledge.htm).

 

Can we read or write this parameter?

  • August 11, 2011
  • Like
  • 0

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

 

 

 

 

Hi...

 

I have a requirement to wrap a text inside a table cell...i have a panelgrid inside which im using repeat. inside repeat i have used a td tag where i am giving it a fixed width...but i am not able to wrap a text if it is too long..this affects the alignment in my table...can any one suggest a proper method to do it...

 

 

<apex:panelGrid >
<apex:repeat value="{!ProcessCellValuesWithoutName}" var="strCellValue">

<td width="200" align="center">

<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">{!strCellValue.recValues}</apex:outputLabel>
<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">&nbsp;&nbsp;&nbsp;</apex:outputLabel>

</td>

</apex:repeat>
</apex:panelGrid>

 

  • March 15, 2010
  • Like
  • 0
 
We have a few VF pages rendered as PDF which are using <Apex: dataTable>. This document is genereated in protrait size with 8 columns. It also include Product Name (80 char).
 
I want the text to be wrapped in each column. If I render the page as HTML then it works, but it does not work for PDF. I am even specifying the columnsWidth attribute.
 
 
Code:
<apex:dataTable width="100%" border="0" id="DataTable" value="{!SalesOrderLines}" var="SalesOrderLine" style="font-size:10px;vertical-align:top;word-wrap: break-word;"  headerClass="headerrow" 
   columnsWidth="60,250,90,50,95,100,100,100" rowclasses="odd,even" >


 <apex:column headervalue="Line">
             <apex:outputField value="{!SalesOrderLine.Name}"/>
 </apex:column>   
 <apex:column style="width: 200px;word-wrap:break-word" >
     <apex:facet name="header">
 {!$ObjectType.SalesOrderLine__c.Fields.Product__c.label}                                 
      </apex:facet>
        {!IF(SalesOrderLine.Product__r.name = null,SalesOrderLine.Product__c, SalesOrderLine.Product__r.name)}
 </apex:column> 
.......
</apex:dataTable>

 I have even tried putting following style for <td> in the page
 
Code:
<style type="text/css">
  td {
    word-wrap: break-word;
  }
</style>

 
Does anyone has any idea, what is the best way to achieve word wraping for PDFs. This is very urgent !!!
 

 
 
I also
  • October 26, 2008
  • Like
  • 0

When deactivating user in the salesforce.com user interface you are given three checkboxes:

Remove user from account teams

Remove user from sales teams of closed opps

Remove user from sales teams of open opps. (This one is checked by default).

When deactivating user with the API, do any of the above occur?

  • December 06, 2004
  • Like
  • 0