• liron169
  • SMARTIE
  • 730 Points
  • Member since 2012

  • Chatter
    Feed
  • 26
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 32
    Questions
  • 231
    Replies

Hi ,

 

I am very new to this. I need a solution and ideas regarding this issue. I will brief out clearly(I believe). I had an existing email templetae. I have got nothing to do with it but to change the header logo.

 

For this I got intial suggestion is To create a visualforce page and a controller to show the header dynamically on the email template depending on the user country code.

 

I have no way to Go. As of now my thought process is create let us say 4 different logos in static resources and create a visua force component for image with a condition of if country code is such then the image orheader should be such. And then call this vf component in  the email template.

 

I need suggestions and solution quickly please.

Below is my for loop to insert records:

 

     
       List<Customer_Product_Summary__c> cslist = new List<Customer_Product_Summary__c>([select id, customer_Product_catalog__c,Primary_Condition__c, account__c from Customer_Product_Summary__c where account__c =: o.accountid]);
     
   for(cCustomer p : getsummary())
   {
        system.debug('@@@@@@@$$$$$:'+p);  

      Customer_Product_Summary__c cs = new Customer_Product_Summary__c();
    
    cs.Account__c = o.accountid;
    cs.Customer_Product_Catalog__c = p.con.id;
    cs.name = p.con.name;  
    cs.Primary_Condition__c = p.con.Condition_1__c;
    cs.Primary_Shape__c = p.con.Shape_1__c;
    cs.Defect_Description__c = p.con.Defect_Description__c;
    cs.Capacity__c = p.con.Capacity__c;
    cs.Bulk_Density__c = p.con.Bulk_Density__c;
    cs.Industry_Segment__c = p.con.Industry_Segment__c;

    If(cs.Customer_Product_Catalog__c!=null){
      try {
      item1.add(cs);
 system.debug('#######################'+cs);
      } catch(System.DMLException e) {
        ApexPages.addMessages(e);

      }    
     }

 

Add the condition to only create the record if cs.Customer_Product_Catalog__c contains a unique value when the record is added to the list 'cslist'?

Thanks

 

  • September 09, 2013
  • Like
  • 0

I have a validation rule that does not seem to be working properly.  

The rule should not affect users with the profile of system admin or a specific user id.  I'm am logging in with the specific user but the error message still comes up.  The user should be able to change the probability from 98% to 97%.

 

AND ( 
OR( 
$Profile.Name<>"System Administrator", 
$User.Id <>"xxxxxxxx"), Probability <> 0.98, ISPICKVAL( StageName, "Too early to Bill"))

 

Any help would be greatly appreciated.

 

Thank you!

I have a pagebock table governed by a wrapper class and im having trouble adjusting some of the column widths.

This is my table on the VF page:

 <apex:pageBlockTable value="{!contractList}" var="c" id="table" rendered="{!NOT(ISNULL(contractList))}">
            <!-- The 'selected' property in the ContactWrapper class -->
            <apex:column width="20px" headervalue="Cancel?" >
            <apex:inputCheckbox value="{!c.selected}"/>
            </apex:column>
            <apex:column width="20px" headervalue="Cancel Date" >
            <apex:inputText value="{!c.cnclD}"/>
            </apex:column>
            <apex:column width="20px" headervalue="Customer Policy Purchase Price" >
            <apex:inputText value="{!c.price}"/>
            </apex:column>
            <!-- The contact fields within the ContactWrapper -->
            <apex:column value="{!c.tContract.Vin_Number__c}" style="text-align: center"  width="105px"/>
            <apex:column value="{!c.tContract.Effective_Date__c}" style="text-align: center" width="95px"/>
            <apex:column value="{!c.tContract.Full_Name__c}" style="text-align: center" width="140px"/>
            <apex:column value="{!c.tContract.Product_Group__c}" style="text-align: center" width="85px"/>
            </apex:pageBlockTable>
            </apex:pageBlock>

 For the fields within the wrapper I am able to adjust the widths on, however, for the checkbox and input fields I cannot adjust thiers and I need to because the way the table is rendering at the moment shoves the other fields off the portion of the page it's meant to display on and it's causing a problem aside from not looking very good.  So, is there any way to adjust the three fields causing the problem I haven't accounted for?  Because at the moment they're running into each other and screw up the flow of the page.

I keep getting the above error when I try to compile. I'm not sure if my placement of return values are off or not. Anyone see what I should be doing differently?

 

 

public List<Task> filterRecords(){
  	actList = new List<Task>();
  	
  	try {
  	actList = [
  	          SELECT Subject, WhatId, activityDate, status, priority, category__c, type__c, whoId
  	          FROM Task 
  	          WHERE activityDate=:act.ActivityDate AND status=:act.Status AND category__c=:act.category__c 
  	               AND type__c=:act.type__c AND priority=:act.Priority
  	          LIMIT 200
  	          ];
  	          
  	 if(actList.isEmpty()){
  	 	ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Could not find any records'));
  	 	return null;
  	 } 
  	 else if(!actList.isEmpty()){
  	 	return actList;
  	 } 
  	}
  	catch(Exception e){System.debug(e.getMessage());}
  }

 

  • August 25, 2013
  • Like
  • 0

I'm sending mail. And while doing so, I have given a link as below:

 

 CaseNotificationmail.setPlainTextBody('Your case Status: ' + c.CaseNumber + 'To view your case <a href=https://na1.salesforce.com/' + c.Id); 

 

But, I think, this a not a good practise because Salesforce may change the instance from n1 to n2 or n3. At that time this code will fail.

 

Is there any way to make it dynamic?

 

-Kaity

  • August 22, 2013
  • Like
  • 0

The purpose of this class is to update a custom field on the Contact record of contacts associated with an opportunity via Opportunity Contact Role, when the Opportunity is a specific stage (Prospecting or Qualification).

 

Currently, when an Opportunity is created or updated I get an error:

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger OpportunityAgentStatus caused an unexpected exception, contact your administrator: OpportunityAgentStatus: execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Class.OpportunityAgentStageProspect.prospect: line 15, column 1

 

Obviously something is wrong with how I'm pulling contacts but I can't figure it out.

 

I'd appreciate the help.

 

Thanks.

public class OpportunityAgentStageProspect {

	public static void prospect(Opportunity[] agentopps) {
		
		for (Opportunity opp :agentopps){
			
			Opportunity opp2 = [select ID, StageName from Opportunity where ID = :opp.Id];
			
			if (opp2.StageName == 'Prospecting' || opp2.StageName == 'Qualification') {
			
				OpportunityContactRole[] contacts = [select ID from OpportunityContactRole where OpportunityID = :opp2.Id];
			
					for (OpportunityContactRole con :contacts){
					
						Contact c = [select ID, Agent_Status__c from Contact where ID = :con.Id];
					
						c.Agent_Status__c = 'Prospect';
						update c;
				}
			
			}
		}
		
	}

}

 

 

Working on a test class.  I'm getting the error:

 

"Invalid initial expression type for field Account, expecting: SOBJECT:Account(or single row query result of that type). I'm new, and am at wit's end trying to figure this out. I'd appreciate some help. Thanks.

 

@isTest
private class TestOpportunityAgentStatus {

    static testMethod void myUnitTest() {
        
        Profile pf = [Select Id from Profile where Name = 'System Administrator'];
		
		User u = new User();
        u.FirstName = 'Test';
        u.LastName = 'User';
        u.Email = 'testuser@test123456789.com';
        u.CompanyName = 'test.com';
        u.Title = 'Test User';
        u.Username = 'testuser@test123456789.com';
        u.Alias = 'testuser';
        u.CommunityNickname = 'Test User';
        u.TimeZoneSidKey = 'America/Mexico_City';
        u.LocaleSidKey = 'en_US';
        u.EmailEncodingKey = 'ISO-8859-1';
        u.ProfileId = pf.Id;
        u.LanguageLocaleKey = 'en_US';
        insert u;
        
        system.runAs(u){
        	
       	
        	Account xxxacc1 = new Account(Name = 'Test Company');
        	insert xxxacc1;


        	Contact xxxcon1 = new Contact(FirstName = 'Test', LastName = 'Guy', Account = xxxacc1.Id);
        	insert xxxcon1;
        	
  	    	
        	Opportunity xxxopp1 = new Opportunity(
        							Name = 'Test Company - New Opp',
        							Account = xxxacc1.Id,
        							CloseDate = Date.today(),
        							StageName = 'Prospecting'
        							);
        	insert xxxopp1;
        	
        	
        	OpportunityContactRole xxxocr1 = new OpportunityContactRole(
        							ContactID = xxxcon1.Id,
        							OpportunityId = xxxopp1.Id,
        							Role = 'Decision Maker'
        							);
        	insert xxxocr1;
        	
        	
        	
        }
        
        
    }
}

 

I have a field that is a formula field that is a concatenation of two other fields.

 

The Custom field is on the Standard Contract Object "Contract.SourceContractID__c" and it's a formula field which concatenates of "Account.Field__c" & "Contract.Number__c" 

 

So if Account.Field__c = 12345

and Contract.Number__c = 00001

 

then, SourceContractID__c = 1234500001.

 

The problem is this:  This SourceContractID__c field is a link to another system.

 

If Account.Field__c CHANGES, then the Formula changes the Contract.SourceContractID__c field to concatentate the new value entered into the Account.Field__c plus the Contract.Number__c (which is a system generated number and cannot be changed.

 

So if Account.Field__c WAS 12345, but changes to 99999

and Contract.Number__c REMAINS 00001

then, Contract.SourceContractID__c CHANGES to 9999900001.

 

This throws off the integration to the other system, because the ID it's looking for has now changed!!!, and screws everything up.  

 

There is a business need to be able to change Account.Field__c, so I can't lock that field down.

 

QUESTION:

Is there a way via a Validation Rule for me to LOCK Contract.SourceContractID__c after it has been initially filled in (even though it is a formula field), so that it cannot be changed if Account.Field__c changes?

 

Thanks in advance for any and all help!

 

Here is the formula field on the Contract Object:

Contract.SourceContractID__c: 

 Account.Field__c & Number__c

 

 

  • August 12, 2013
  • Like
  • 0

OK, gonna keep this short ... I am new to Apex and especially writing test classes is giving me a headache ... HELP PLEASE!!!

 

Here is the class ... (took out some code and replaced with ... for easier reading)

public class DoPaymentHandler{

    public DoPaymentHandler(){       
    }

    public DoPaymentHandler(ApexPages.StandardController controller) {
        this.reg = (Registration__c)controller.getRecord();
    }
    
   ...        
    
    //Handling payment processing submitting by VF page button
    public void process(){
        isSuccess = false;

        amount =         String.valueOf(reg.Open_Amount__c);
        ponumber =       reg.Event__r.PO_Number__c;
        description =    reg.Event__r.Name;
        firstname =      reg.Participant__r.First_Name__c;
        lastname =       reg.Participant__r.Last_Name__c;
        email =          reg.Participant__r.Email__c;
        state =          reg.Participant__r.Billing_State__c;
        zip =            reg.Participant__r.Billing_ZIP__c;
        cardnumber =     reg.Participant__r.Credit_Card__c;
        expiration =     reg.Participant__r.Expiration_Date__c;
    
        if(!validate()){
            isSuccess = false;
            return;
        }
        
        AuthorizeDotNet ath = new AuthorizeDotNet(isTest);
        ath.transaction(cardnumber, expiration, amount, '','','');  
        ath.setParameter('x_device_type','1');  
        ath.setParameter('x_first_name',firstname);  
        ath.setParameter('x_last_name',lastname);  
        // ath.setParameter('x_address',address);  
        ath.setParameter('x_state',state);  
        ath.setParameter('x_response_format','1');  
        ath.setParameter('x_zip',zip);
        ath.setParameter('x_po_num',ponumber);  
        ath.setParameter('x_description',description);  
        try{
            ath.process(3);
        }catch(Exception ex){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, ex.getMessage())); 
            isSuccess = false;
        }
        ...        
    }
    
    private boolean validate(){

        ...              
    }
}

 

Here is the test class ...

public class TestAuthorizeDotNetLib{
   @isTest
   private static void testclasses(){
        DoPaymentHandler doPayment = new DoPaymentHandler();
        doPayment.process();
        doPayment.amount='test';
        doPayment.ponumber='test';
        doPayment.description='test';
        doPayment.firstname='test';
        doPayment.lastname='test';
        doPayment.email='test';
        doPayment.state='test';
        doPayment.zip='test';
        doPayment.cardnumber='test';
        doPayment.expiration='test';
        doPayment.process();
   }
}

 

When running the test I get the error message "Problems with System.NullPointerException: Attempt to de-reference a null" on the line with "doPayment.process();"

 

Help is much appreciated.

 

Robert aka TheFrisco

Hi,

 

I have 4 checkboxes and 4 pageblock sections in my visualforce page.

 

Conditions:

When I check checkbox 1 -> Section 1&3 has to get displayed

When I check checbox 2 -> Section 1&3 has to get displayed 

Checkbox 3 -> Section 2

Checkbox 4 -> Section 4

 

Currently it works For Checkbox 1. But when I use the same rendered attribute value for Checkbox 2 both the checkboxes (1 & 2) stop working. I don't want to duplicate the sections. I would like to use the same attribute so that it returns the same section.

 

I would really appreciate if someone could give me any suggestions or feedback.

 

Thanks!

trigger createOrderforABFSCB on Stem_Cell_Bank__c (after update) {

    List<ChargentOrders__ChargentOrder__c> co = new List<ChargentOrders__ChargentOrder__c>();	
   
	for (Stem_Cell_Bank__c scb : Trigger.new) {
		if (scb.Stage__c == 'Stem Cells Banked') { /*scb to oscb*/
			
			//initiate the object to put values for furture record
			ChargentOrders__ChargentOrder__c c = new ChargentOrders__ChargentOrder__c();

			//map Order fields to SCB that is being created for this Order
			c.Stem_Cell_Bank__c = scb.Id; /*scb to oscb*/

	        c.ChargentOrders__Date__c = date.today();
	        c.ChargentOrders__Gateway__c = 'xxxxxxxxxxxxxxxxx';
	        c.ChargentOrders__Currency__c = 'U.S. Dollar';
	        c.Order_Item__c = 'Yearly Subscription Fee';
                // add one year to stem cell banked date
                c.ChargentOrders__Payment_Start_Date__c = scb.Stem_Cells_Banked_Date__c.addYears(1);

	        
			//add this new object to the list that would be inserted later
			co.add(c);
		} //end if
	} //end for scb
	
	//once the loop is done, insert the new record to Order
	try{
		insert co;
	} catch (system.Dmlexception e) {
		system.debug(e);
	}

}

 

Hi, as you could see, i have a pretty straightforward trigger, but i am getting the following error:

System.NullPointerException: Attempt to de-reference a null object Trigger.createOrderforABFSCB

 

it appears to not like c.ChargentOrders__Payment_Start_Date__c = scb.Stem_Cells_Banked_Date__c.addYears(1);

 

Stem_Cells_Banked_Date__c is a DATE data type, but i can't seem to use the addYears() method

 

Any suggestion would be appreciated.

 

thank u

Hi All,

 

I need to send an email with a PDF attachment.  I have developed a normal visualforce page (didn't render as PDF). And then using apex code, am getting the body of it, and sending it as PDF attachment.

 

I am receving the email with the PDF attachment, but when I try to open the PDF, it isn't opening.  It gives the following decode error - "Adobe reader cannot open the PDF because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)"

 

Below is the Apex class that is taking the body of vf page and making it a PDF attachment.  Please let me know if I am missing anything.  Thanks.

 

global class CustomersPDF_SendEmail implements Schedulable {

    global void execute(SchedulableContext sc) {    
        
        PageReference pdf = Page.CustomersPDF;
        pdf.getParameters().put('id','001O000000ECvg4');
     
        Blob body;
     
        try {
          body = pdf.getContent();
        } 
        catch (VisualforceException e) {
          body = Blob.valueOf('Some Text');
        }
     
        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
        attach.setContentType('application/pdf');
        attach.setFileName('KeyCustomers.pdf');
        attach.setInline(false);
        attach.Body = body;
     
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setUseSignature(false);
        mail.setToAddresses(new String[] {'abc@gmail.com'});
        mail.setSubject('Customers PDF - Demo');
        mail.setHtmlBody('Check the attachment!');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); 
     
        // Send the email
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });               
    
    }
}

 

 

Hello all

 

I am trying to include a REGEX in a field validation rule to check that for a given field of length 8 chars, the value entered has the following syntax:

 

1st char:  X

2nd char: any alpha numeric

3rd char: any alpha numeric

4th char: any alpha numeric

5th char: any alpha numeric

6th char: 0

7th char: 1

8th char: any alpha numeric

 

I have tried the following but its not quite there.  Could anyone please suggest a solution?

 

NOT(REGEX(field__c, "(X\\[a-zA-Z0-9]{5}\\01\\[a-zA-Z0-9]{1})"))

 

Many thanks in advance.

  • October 30, 2012
  • Like
  • 0

In formula its displaying me record id, I want to display a record name. What is the possible way I tried adding TEXT() at the begnning but its not working.

 

 NMTC_Fund_Partnership__r.NMTC_Fund__r.General_Partner_Master_Allocatee__c 

 

Here in formula  "General_Partner_Master_Allocatee__c" is lookup field. 

  • October 30, 2012
  • Like
  • 0

// search query
    private transient boolean productdata_refreshed = false;
    private void refreshProductData()
    {
            if (productdata_refreshed==null || productdata_refreshed!=true) {
                cacheProductData = new List<ProductData>(); 
            
                //system.debug('--------------- refreshProductData reads data');
            
                Set<ID> exclude = new Set<ID>();
                if (options.excludeProducts!=null)
                    exclude.addAll(options.excludeProducts);
                
                string sexclude = null;
                if (exclude.size()>0)
                    sexclude = 'not in (' + Utils.qjoin(',', exclude) + ')';
                
                exclude = null;
                
                               
                    string soql =   'Select p.Name, p.Id, p.Family__c,p.APVMA_Approval_number__c, ' +
                                    'p.Price_per_L_per_Kg__c, p.Label__r.Country__c ' +
                                    'From Label_Part__c p ' +
                                    'Where ' +
                                    'p.Active__c = True '+
                                    'and (p.Label__r.Country__c = \'' + options.country + '\') ';
                             
                    if (sexclude!=null)
                        soql += 'and (p.Id '+sexclude +') ';
                                    
                    if (selectedProductFamily!=null)
                    {
                        soql += 'and (p.Family__c=\'' + selectedProductFamily + '\') ';
                        
                    }
                    else
                        soql += 'and (p.Family__c in ('+ Utils.qjoin(',', options.productFamilyFilter) +')) ';
    
    
                    if (selectedProduct != null && selectedProduct.trim()!='')
                        soql += 'and (p.Name like  \'%' + string.escapeSingleQuotes(selectedProduct.trim()) + '%\') ';

                    soql += 'order by p.Name limit 300';      
                    
                    for (Label_Part__c p : Database.query(soql))
                        cacheProductData.add(new ProductData(p, this));
                    
                productdata_refreshed = true;    
            }
    }

 

 

here is the my code i want to wild search with this

 

for eg : if provide a* it has to display the products with a only currently it is deplaying all products .

 

could you please help me here.

  • October 29, 2012
  • Like
  • 0

Hi there. I m newbie in developement via this platform, so be patient.

 

I trying to create simple Visualforce page that contains a table with my merchandises (like a Warehouse testing app in workbook) and control buttons on this page. Control buttons are "Edit", "Save", "New", "Find", "Delete" and others like in standart controllers.

How to create logic to this buttons? I was created "Find' button and added logic. Thiis was simple.

But how to create logic in apex class to save edited row in table? In each colomn i added   <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>, so i can edit some rows in some columns that i need.

But how to insert changes in table? Where i need to find variables, that contains number of row edited and name of the column?

 

So, please help me - tell, or show the sources, how to realise that logic.

Same problems with  "Add new object to table"   and "Delete object from table" logic .

My Visualforce page source code:

<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
           controller="VRP_controller" >
    <apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}"/>
    <h1>Headphones Shop</h1>
    <apex:form >
   <apex:dataTable value="{!products}" var="pitem" rowClasses="odd,even">
        <apex:column headerValue="Product">
            <apex:outputfield value="{!pitem.merchandise.name}">
            <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
          </apex:outputField>
        </apex:column>         
        <apex:column headerValue="Product type">
            <apex:outputField value="{!pitem.merchandise.Product_Type__c}">
       <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
          </apex:outputField>
        </apex:column>
        <apex:column headerValue="Count in Stock">
            <apex:outputField value="{!pitem.merchandise.Product_Count__c}">
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
          </apex:outputField>
           </apex:column>
        <apex:column headerValue="Available">
            <apex:outputText value="{!pitem.merchandise.In_Stock__c}"/>
                     </apex:column>
        <apex:column headerValue="Release Date">
            <apex:outputText value="{0,date,yyyy.MM.dd}">
 <apex:param value="{!pitem.merchandise.Release_Date__c}" />
     
   </apex:outputText>
        </apex:column>
        <apex:column headerValue="Date Added">
            <apex:outputField value="{!pitem.merchandise.Date_Added__c}">
       <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
          </apex:outputField>
         </apex:column>
        <apex:column headerValue="Description">
            <apex:outputField value="{!pitem.merchandise.Description__c}"/>
       
        </apex:column>
       
        
</apex:dataTable>
<br />
<apex:PageBlock >

                <apex:commandButton value="Edit" action="{!save}" id="editButton" />
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" /> 

</apex:PageBlock>


<apex:inputText value="{!textarea}" />
   
<apex:commandButton action="{!find}" value="Find" />
<apex:commandButton action="{!back}" value="Back" />


    </apex:form>
</apex:page>

 My Apex cusom controller code:

public class VRP_controller {

    public PageReference cancel() {
        return null;
    }

  
    
    public String message { get; set; }
    public String eval { get {return eval;} set{eval ='%'+value+'%';} }
   public String textarea { get {return textarea;} set{textarea = value;} }
    public PageReference back() {
      products=null;
       getProducts();
       return null;
    }
   
     public PageReference save() {
   for (DisplayMerchandise item :
            products) {

             insert item.merchandise;
             }
       return null;
    }
     public PageReference find() {
         eval=textarea;
       findProducts();
                
     return null;
    }  
        
    DisplayMerchandise[] products;
    DisplayMerchandise[] findedProducts;
    DisplayMerchandise[] backupProducts;
    public static boolean lock=false;
     
    
      
    public class DisplayMerchandise {
           
         public VRP_testing_app__c merchandise { get; set; }
        public DisplayMerchandise(VRP_testing_app__c item) {
            this.merchandise = item;
        }
   
    }

    public DisplayMerchandise[] getProducts() {
        if(products==null){
          products = new DisplayMerchandise[]{};
           for (VRP_testing_app__c item :
            [SELECT Name, Product_Type__c, Product_Count__c, In_Stock__c, Release_Date__c,Date_Added__c,Description__c
             FROM VRP_testing_app__c
             WHERE  In_Stock__c=true]) {

               products.add(new DisplayMerchandise(item));
             }
         }
     return products;      
    }
    
    public DisplayMerchandise[] findProducts(){
           
           findedProducts = new DisplayMerchandise[]{};
             for (VRP_testing_app__c item :
            [SELECT Name, Product_Type__c, Product_Count__c, In_Stock__c, Release_Date__c,Date_Added__c,Description__c
             FROM VRP_testing_app__c
             WHERE  (Name LIKE :eval)]){
              findedProducts.add(new DisplayMerchandise(item));
           }
         products=findedProducts;
     return findedProducts;      
    }
        
    }

 I know that is the bad style programming code, but i'm only studying.

Sorry for bad english - is not my native language.

I have a visualforce page and cannot get the test page to work.  Here is my visualforce page. 

<apex:page standardController="Ticket__c" extensions="TicketExtension">
<style type="text/css">
.odd{background-color: #DBDBDB;} 
.even{background-color:#E4E4E4;}
</style>
<apex:pageBlock title="Open Tickets"  >
<apex:dataTable value="{!openTickets}" var="OT" columnsWidth="134px, 250px, 61px, 250px, 82px, 250px, 103px" rowClasses="odd,even">
<apex:column >Brief Ticket Description:</apex:column><apex:column value="{!OT.Brief_Description__c}" />
<apex:column >CC Email:</apex:column><apex:column value="{!OT.CC_Email__c}"/>
<apex:column >Ticket Details:</apex:column><apex:column value="{!OT.Request_Description__c}"/>
<apex:column >Ticket Created By:</apex:column><apex:column value="{!OT.CreatedBy.name}"/>
</apex:dataTable>
<apex:form >
<apex:commandButton value="New Ticket" action="{!redirectNewTicket}"/>
</apex:form>
</apex:pageBlock>
<apex:pageBlock title="Closed Tickets">
<apex:dataTable value="{!closedTickets}" var="CT" columns="3" columnsWidth="134px, 250px, 61px, 250px, 82px, 250px, 103px" rowClasses="odd,even">
<apex:column >Brief Ticket Description:</apex:column><apex:column value="{!CT.Brief_Description__c}" />
<apex:column >CC Email:</apex:column><apex:column value="{!CT.CC_Email__c}"/>
<apex:column >Ticket Details:</apex:column><apex:column value="{!CT.Request_Description__c}"/>
<apex:column >Ticket Created By:</apex:column><apex:column value="{!CT.CreatedBy.name}"/>
</apex:dataTable>
</apex:pageBlock>
</apex:page>

 here is my controller

public with sharing class TicketExtension {

    public TicketExtension(ApexPages.StandardController controller) {
        this.user_object = (CAG_tickets__Ticket__c)Controller.getRecord();
    }

    //Shows all open tickets
    public list<CAG_tickets__Ticket__c> getopenTickets(){
        return [select CAG_tickets__Brief_Description__c, CreatedBy.name, CAG_tickets__CC_Email__c, CAG_tickets__Request_Description__c, CAG_tickets__How_Urgent_is_the_Request__c from CAG_tickets__Ticket__c where CAG_tickets__Is_Closed__c = false];
    }
    
    //Shows all closed tickets
    public list<CAG_tickets__Ticket__c> getclosedTickets(){
        return [select CAG_tickets__Brief_Description__c, CreatedBy.name, CAG_tickets__CC_Email__c, CAG_tickets__Request_Description__c, CAG_tickets__How_Urgent_is_the_Request__c from CAG_tickets__Ticket__c where CAG_tickets__Is_Closed__c = true];
    }

    //section to create a new ticket.
    public string ccEmail {get;set;}
    public string briefDescrip {get;set;}
    public string descrip {get;set;}
    public string ur {get;set;}
    
    public PageReference createNewTicket(){
        CAG_tickets__Ticket__c t = new CAG_tickets__Ticket__c(CAG_tickets__Brief_Description__c=briefDescrip, CAG_tickets__CC_Email__c=ccEmail, CAG_tickets__How_Urgent_is_the_Request__c=ur, CAG_tickets__Request_Description__c=descrip);
        insert t;
        PageReference pageRef = new PageReference('https://cag-tickets.na11.visual.force.com/apex/tickets');
        return pageRef;
    }
    
    //Redirects the new ticket button to the new ticket apex page
    public PageReference redirectNewTicket(){
        PageReference pageRef = new PageReference('/apex/newticket');
        return pageRef;
    }
    
    
    
    
    //this section populates the options field with the picklist values.
    private final CAG_tickets__Ticket__c user_object;
    public List<selectOption> getPickValues(Sobject object_name, String field_name) {
        List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
        Schema.sObjectType sobject_type = object_name.getSObjectType(); //grab the sobject that was passed
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); //describe the sobject
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap(); //get a map of fields for the passed sobject
        List<Schema.PicklistEntry> pick_list_values = field_map.get(field_name).getDescribe().getPickListValues(); //grab the list of picklist values for the passed field on the sobject
        for (Schema.PicklistEntry a : pick_list_values) { //for all values in the picklist list
            options.add(new selectOption(a.getLabel(), a.getValue())); //add the value and label to our final list
        }
        return options; //return the List
    }
    
    //picklist values
    public List<selectOption> geturList(){
        return getPickValues(user_object, 'How_Urgent_is_the_Request__c');
    }

    
    




}

 And here is the test method I have written.

public class testTicketsPage {
    static testMethod void testMyTicketsPage(){
    
    CAG_tickets__Ticket__c t = new CAG_tickets__Ticket__c(CAG_tickets__Brief_Description__c='brief description', CAG_tickets__CC_Email__c='cc@email.com', CAG_tickets__How_Urgent_is_the_Request__c='1 - This would be nice to have.', CAG_tickets__Is_Closed__c=True, CAG_tickets__Request_Description__c='Request Description');
    insert t;
    
    CAG_tickets__Ticket__c t1 = new CAG_tickets__Ticket__c(CAG_tickets__Brief_Description__c='brief description', CAG_tickets__CC_Email__c='cc@email.com', CAG_tickets__How_Urgent_is_the_Request__c='1 - This would be nice to have.', CAG_tickets__Is_Closed__c=False, CAG_tickets__Request_Description__c='Request Description');
    insert t1;
    
    PageReference ref = new PageReference('/apex/tickets');
    test.setCurrentPage(ref);    
    
    TicketExtension con = new TicketExtension();    
    con.getopenTickets();
}
}

 I am new to testing visualforce pages.  the issue I seem to be having is that when I run the test the debug log says "Attempt to de-reference a null object".  Any idea on what I am doing wrong?

Hi,

 

I have two Objects A and B. A is master and B is child.

My scenario : When ever new record is created in B or whenever existing record is updated in B then, value in object A should also get updated based on most recent value of B.

 

Ex: If value added to B is 6 then it should be reflected in A as 6.

I have done this using trigger but I want it through workflow. Is there any option for doing this. Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi 

   I have custom object and account is lookup to my custom object field. I am able to retrieve account record value from the lookup field but I am getting the id of the record . I need to get the name of the record.

How can I achieve it?

for eg: The record name is Ac_record and is 123456609xya i am only getting id not the name of the record.

 

my code:

obj = select id, name, Location__c from customObj__c where id in: setId;
srting location = obj.Location__c;
location__c is lookup to Account

 

 

Please help me to solve this issue.

Thanks

Anu

 

 

Hi.
I'm using function getContent(), to get blob of PDF page.

There are cases where the PDF is empty (blank page), and it's fine. The question how can I detect it.

-I cannot inspect the blob ,as the characters have no meaning....
-In the controller of the PDFpage I have such indication, but I cannot access it in the caller process.

Any suggestions?

PageReference page = new PageReference('/apex/PDFpage...');
blob bodyAttach=page.getContent();
Hi,
Possible that this limitation was removed lately??
I'm quite sure I could see it in the limitation list, 2 weeks ago, now it's not listed there.

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
 
Hello,
Need advise please, if below funcionality can be done with SF standard reports (perhaps join report? ).

Assume I have 3 objects:
Object A
Object B (child of A)
Object C (child of A)

I need excel Report with the following columns:

(1)A.name 
(2)Total B records where B.name='X'
(3)Total B records where B.name='Y'
(4)Total C records where C.name='M'
(5)Total C records where C.name='N'

of course, it can be done, by creating roll-up summary fields on the main object.
The question is if it can be done without - means the calculations of the total will be done in the report?

Thanks.
Hi,
If I create FeedItem + Attachment and after a period I need to delete all the old FeedItem -for example, those that before 30 days.
<Note that all this is with apex code, not manually>

I understand that deleting the FeedItem is not deleting the attachment file, so I found that I can delete the attachments by querying ContentDocument object.

The problem is that I want to delete only the attachment that related to the feeds that were deleted, not all those in ContentDocument.
Assume that I can mark those attachments in some way (when creation) that will help to retrieve only them when need to delete them.

But perhaps I can avoid it? Does SF store in some way the connection between the FeedItem in its attachment?
Hi,

I have report - PDF page - that run sometimes on large amount of data.
with too much data, it failed when loading the page to the screen, so I try different approach- generating the page in background, and attach it to the chatter.
It does incrase the capacity of the report, but still in some amount of data it fails, and I can see in log Internal Salesforce.com Error.
I'm not hitting any other SF limitation (CPU close to limit, but not beyond).

The PDF (that failed) expected to be ~1.5MB, with ~800-1000 pages.
I able to generate it with ~1MB, ~600 pages.

Anyone have idea possible reason for this error?




global class AddPdfToRecord{
    webservice static void addPDF(){ 
     
       PageReference pdf = Page.TestLiron;
      
       pdf.getParameters().put('parm1','111');
       pdf.getParameters().put('parm2','222');
 
       pdf.setRedirect(true);
      
      //system.debug('URL: ' + pdf.getURL());

       Attachment attach = new Attachment();
       Blob body;
       try
       {
           body = pdf.getContentasPDF();        //here the failure

            // post to chatter
            FeedItem post = new FeedItem();
            post.ParentId = '0F9c00000008efE'; // nickforce chatter group id
            post.Body = 'Report for..';
            post.Type = 'ContentPost';
            post.ContentData = body;
            post.ContentFileName = 'FMR_TEST' + '.pdf';

            insert post;
       }
       catch(Exception e)
       {system.debug('EEEEEEEEEEEEEEEE'  + e) ;}
   }
}
Hi,
We have several objects that calculation of their sharing rules done in apex code.
This code is complex and dirty and hard to maintain. So I review it - and found option to move it into the UI - means calculate it with sharing rules base criteria.


There are 2 optional problem:

1.We might need to increase the available sharing rules criteria. Current limit is 50, and SF support already confirm that we can increase it, but the concern is if it will affect performance significantly?
(currently we will have 20 criteria, but in future it might increase to ~60)

2.Might need to use complex criteria. Would that reduce the performance significantly?
e.g.:   (6 AND ((2 AND (3 OR 4 OR 5)) OR (1 AND 3))) OR (7 AND 8)


Does someone have exprience with this and can advise?
Thanks.
Hi,
I have this excpetion.
I already read other questions in this issue and understand what does it means.

However, in my code I'm adding only 2 type of sobjects + adding them per list. means:

list<object1> l_first;
list<object2> l_second;
list<sobject> lsobject;

lsobject.addAll(list<sobject> l_first);
lsobject.addAll(list<sobject> l_second);

database.insert (lsobject, false);


So according to what I read I don't supposed to have this exception.

It happen only lately for large volumes of data.
Is it possible that due to size of data in the final list (lsobject), SF split the list to chunks and then go back and forth from l_first object to l_second?
Otherwise, I cannot figure why I'm getting this error.

And if so, the only solution is to split it into 2 seperaed lists?

thanks.
Hi,
I have controller that I want to define most of the logic inside as 'ReadOnly'.
Since I cannot set this attribute to the constructor, I create webservice function 'ReadOnly' and call it from the constructor to set all the require data for the page.

However, it's also require from me to change most of the variable in the controller to be 'static' (otherwise the webservice function cannot set those variable.

The questions is what impact such change might have (change the variable to 'Static')?
Can it cause any harm in the page?
And whether this is correct from programming prespective and SF best practice?
Hi,
I have page generate as PDF with huge amount of data. Due to the amount of data it sometimes fail (seems like timeout when loading the page, no excpetion on SF limitations).

I tried as solution to generate the page in memory and add as PDF attachment. Wrote small class (below) for testing and run it from the developer console.
When I run it for small data all is fine and its working.
But if I try it with huge data then, for some wired reason, I see that the page being generated over and over every minute (I see every minute call in the developer console), and add attachment per each run.

If I try it with very huge amount of the data, then also the page being generated every minute, but no pdf attachment is created (also can see internal error exception but without other information).

At first, I thought it's something in the code, but as it is working fine for small set of data, I'm thinking it's something internal for SF? Maybe someone have idea for this behavior?
+ Any other suggestions to enhance this process- to support huge data - will be welcome (I don't think it's related to crappy or un standard code, it's simply too much data, so I'm looking for general approach for this)

Thanks.

global class AddPdfToRecord{
   
    webservice static void addPDF(){
      
       pageReference pdf = Page.RepTestLiron;
      
      
       pdf.getParameters().put('cfr','test');
       pdf.getParameters().put('cto','');
       pdf.getParameters().put('del','');
       pdf.getParameters().put('efcont','A');;
       pdf.getParameters().put('hv','A');
       pdf.getParameters().put('repid','a1zD0000000L6WmIAK');
      
       system.debug('URL: ' + pdf.getURL());

       Attachment attach = new Attachment();
       Blob body;
       try
       {
           body = pdf.getContentasPDF();
       }
       catch(Exception e)
       {system.debug('EEEEEEEEEEEEEEEE'  + e) ;}
       attach.Body = body;
       attach.Name = 'FMR_TEST.pdf';
       attach.IsPrivate = false;
       attach.ParentId = '001D000000wqkSY';
           
        
        
       insert attach ;
    }
}

Hello,

 

I have list of records in page with checkbox on each (with wrapper class).

I'm trying to write with JQuery that only one record will be selected at time.

 

Can someone advise what wrong with below script?

It's seems that this script update the wrong data + changing the order in the list...

 

<script>
        var j$ = jQuery.noConflict();
        jQuery(document).ready(function() {
jQuery(".selected-checkbox").click(function() {
var checkedRow = this;
        //alert('Hello world, part 2!'+ checkedRow );
 jQuery(".selected-checkbox").each(
            function() {
                this.checked= false;
            }
        );
checkedRow.checked= true;

});
});
     
</script>

Hello,

 

Is there any way to get the first line from long text field without writing a trigger?

 

I read somewhere that formula function cannot detect break line, so maybe with workflow rule or any other solution?

I'm trying to insert image into richText field, and having some issues.

It seems that when I insert the image, it shrink to smaller sizes then the orignal image.
I can resize in the field (by streching it), and it's working OK.


But then we need to move this data between enviroments (DEV - QA - Production), and every time I download the image from the source enviroment, and insert it to the target enviroment.
But each time the image size shrink, and need to amend it manually.
I'm worried it might cause data to not be synchronize.

My qeustion. Thinking one of below can help for this issue:
1.Why at all the image shrink when it is insered? any way to insert it in the original size?
2.Any way to move this data between enviroments, with the image? It surly cannot move with data loader.


Hello,

 

I'm little bit confuse from all the different limitation in SF.

Can someone explain the limitation of sending emails from apex code to the working user?

I think that we don't have any limitation, but need to make sure



The code will be somthing like this...

 

for(String objid : objLst)
{
	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
	
	email.setTargetObjectId(UserInfo.getUserId());
	email.setTemplateId('needToCreate');
	email.setWhatId(objid);
	
	emails_Lst.add(email);
}


Messaging.sendEmail(emails_Lst);

 

Hello,

 

We have process that open many records in 1 PDF (visual page render as PDF), than user sent it to print.

Problem arises due SF limitations, like: script statements, heap size, Images in PDF size - I think 30MB
(it is not that code is not efficient, but it is many records and logic).


We thinking to move this process to work as batch process, which will increase the limits, and sent the PDF to user by
email. But I don't see how it will solve the issue of PDF limitation.

Is there any suggestion how to overcome those issue (except limit number of records that user can select in one action)?

I have VF page as PDF + apex class, that currently working OK.

Both are in API 25.

 

If I change the API of the page to 28, than non of the CSS definition are not working (when changing to 27 it's works).

 

Does anyone know what has changed in this API that might causing it?

Hello,

 

When the option 'Build Automatically' in eclipse is checked, I understand that sometimes after saving the process will do a build for all the workspace.
The question is if in that process it's takes all the objects (from my eclipse workspace), and save them to server?

According to the fact that the last modifed date updated in all classes (in time this happen), it's seems so.
Is that means that in case of discrepncies between local file in the eclipse to the file in server, it will override the source in server?

I have VF page render as PDF, with some CSS definitions (including Footer, Header).
Now I want to create similar page as Word.

Appriciate if someone can advise if, at all, I can controll the layout in word in same level I can in PDF?
And if so, what generally I should change from the original page (this as PDF)?
except to replace the renderAs="PDF" --> contentType="application/msWord", is modifying the CSS file will be enough?

Hello,

 

Need advise if I can achieve the following requirment without writing code.

 

 

I have custom_object and below child custom_object.

In the child object have several custom fields:
customField1
customField2
customField3

 


The requirement is that for each paernt object those fields on all childs will be unique.

example:

 

If I have:
parentObj1
    below:
        childObject1
        childObject2


Then the following fields must be unique:
childObject1.customField1
childObject1.customField2
childObject1.customField3
childObject2.customField1
childObject2.customField2
childObject2.customField3

 


Any suggestion?

Hi,

 

I want to share this page + class I wrote to support mass edit of records for any object.

 

You welcome to take a look and try it.

 

Mass Edit Page

 

Hello,

 

I'm trying to use JS in visualforce page. The target is when the user input data in specific field - to update this value in input field in a list.

the problem: the value property (from the list) return 'undefied'.

However, if I try to get the InnerHTML and print it I get:

 

<input id="docPage:frm:results:Data&colon;0:j_id39" maxlength="30" name="docPage:frm:results:Data&colon;0:j_id39" size="20" value="1" type="text">

 

so I assume that I refering to the field correctly.

 

Any idea how to solve it?

 

by the way, if I'll update the InnerHTML property than the problem is that field became from InputText to OutputText.

 

<script type="text/javascript">
    function updateAll()
    {
	//Input value from User
        var userInput= document.getElementById('{!$Component.frm.mainblock.massFields.inputSection.inputID}').value;
        
        //list Size
        var listSize = {!blLst.size};
        
        for (i = 0; i < listSize; i++)
        {
            var test = document.getElementById('docPage:frm:results:Data&colon;' + i + ':MTVsID').value;
            alert(test);	//get popup with Undefined
            
        }
    }
</script>

 

 

 

Hi,
If I create FeedItem + Attachment and after a period I need to delete all the old FeedItem -for example, those that before 30 days.
<Note that all this is with apex code, not manually>

I understand that deleting the FeedItem is not deleting the attachment file, so I found that I can delete the attachments by querying ContentDocument object.

The problem is that I want to delete only the attachment that related to the feeds that were deleted, not all those in ContentDocument.
Assume that I can mark those attachments in some way (when creation) that will help to retrieve only them when need to delete them.

But perhaps I can avoid it? Does SF store in some way the connection between the FeedItem in its attachment?
Hi,

I have report - PDF page - that run sometimes on large amount of data.
with too much data, it failed when loading the page to the screen, so I try different approach- generating the page in background, and attach it to the chatter.
It does incrase the capacity of the report, but still in some amount of data it fails, and I can see in log Internal Salesforce.com Error.
I'm not hitting any other SF limitation (CPU close to limit, but not beyond).

The PDF (that failed) expected to be ~1.5MB, with ~800-1000 pages.
I able to generate it with ~1MB, ~600 pages.

Anyone have idea possible reason for this error?




global class AddPdfToRecord{
    webservice static void addPDF(){ 
     
       PageReference pdf = Page.TestLiron;
      
       pdf.getParameters().put('parm1','111');
       pdf.getParameters().put('parm2','222');
 
       pdf.setRedirect(true);
      
      //system.debug('URL: ' + pdf.getURL());

       Attachment attach = new Attachment();
       Blob body;
       try
       {
           body = pdf.getContentasPDF();        //here the failure

            // post to chatter
            FeedItem post = new FeedItem();
            post.ParentId = '0F9c00000008efE'; // nickforce chatter group id
            post.Body = 'Report for..';
            post.Type = 'ContentPost';
            post.ContentData = body;
            post.ContentFileName = 'FMR_TEST' + '.pdf';

            insert post;
       }
       catch(Exception e)
       {system.debug('EEEEEEEEEEEEEEEE'  + e) ;}
   }
}

Hello,

 

Is there any way to get the first line from long text field without writing a trigger?

 

I read somewhere that formula function cannot detect break line, so maybe with workflow rule or any other solution?

Hi.
I'm using function getContent(), to get blob of PDF page.

There are cases where the PDF is empty (blank page), and it's fine. The question how can I detect it.

-I cannot inspect the blob ,as the characters have no meaning....
-In the controller of the PDFpage I have such indication, but I cannot access it in the caller process.

Any suggestions?

PageReference page = new PageReference('/apex/PDFpage...');
blob bodyAttach=page.getContent();
Hi,
If I create FeedItem + Attachment and after a period I need to delete all the old FeedItem -for example, those that before 30 days.
<Note that all this is with apex code, not manually>

I understand that deleting the FeedItem is not deleting the attachment file, so I found that I can delete the attachments by querying ContentDocument object.

The problem is that I want to delete only the attachment that related to the feeds that were deleted, not all those in ContentDocument.
Assume that I can mark those attachments in some way (when creation) that will help to retrieve only them when need to delete them.

But perhaps I can avoid it? Does SF store in some way the connection between the FeedItem in its attachment?
Hi,

I have report - PDF page - that run sometimes on large amount of data.
with too much data, it failed when loading the page to the screen, so I try different approach- generating the page in background, and attach it to the chatter.
It does incrase the capacity of the report, but still in some amount of data it fails, and I can see in log Internal Salesforce.com Error.
I'm not hitting any other SF limitation (CPU close to limit, but not beyond).

The PDF (that failed) expected to be ~1.5MB, with ~800-1000 pages.
I able to generate it with ~1MB, ~600 pages.

Anyone have idea possible reason for this error?




global class AddPdfToRecord{
    webservice static void addPDF(){ 
     
       PageReference pdf = Page.TestLiron;
      
       pdf.getParameters().put('parm1','111');
       pdf.getParameters().put('parm2','222');
 
       pdf.setRedirect(true);
      
      //system.debug('URL: ' + pdf.getURL());

       Attachment attach = new Attachment();
       Blob body;
       try
       {
           body = pdf.getContentasPDF();        //here the failure

            // post to chatter
            FeedItem post = new FeedItem();
            post.ParentId = '0F9c00000008efE'; // nickforce chatter group id
            post.Body = 'Report for..';
            post.Type = 'ContentPost';
            post.ContentData = body;
            post.ContentFileName = 'FMR_TEST' + '.pdf';

            insert post;
       }
       catch(Exception e)
       {system.debug('EEEEEEEEEEEEEEEE'  + e) ;}
   }
}
Hi,
We have several objects that calculation of their sharing rules done in apex code.
This code is complex and dirty and hard to maintain. So I review it - and found option to move it into the UI - means calculate it with sharing rules base criteria.


There are 2 optional problem:

1.We might need to increase the available sharing rules criteria. Current limit is 50, and SF support already confirm that we can increase it, but the concern is if it will affect performance significantly?
(currently we will have 20 criteria, but in future it might increase to ~60)

2.Might need to use complex criteria. Would that reduce the performance significantly?
e.g.:   (6 AND ((2 AND (3 OR 4 OR 5)) OR (1 AND 3))) OR (7 AND 8)


Does someone have exprience with this and can advise?
Thanks.
Hi,
I have this excpetion.
I already read other questions in this issue and understand what does it means.

However, in my code I'm adding only 2 type of sobjects + adding them per list. means:

list<object1> l_first;
list<object2> l_second;
list<sobject> lsobject;

lsobject.addAll(list<sobject> l_first);
lsobject.addAll(list<sobject> l_second);

database.insert (lsobject, false);


So according to what I read I don't supposed to have this exception.

It happen only lately for large volumes of data.
Is it possible that due to size of data in the final list (lsobject), SF split the list to chunks and then go back and forth from l_first object to l_second?
Otherwise, I cannot figure why I'm getting this error.

And if so, the only solution is to split it into 2 seperaed lists?

thanks.
Hi,
I have page generate as PDF with huge amount of data. Due to the amount of data it sometimes fail (seems like timeout when loading the page, no excpetion on SF limitations).

I tried as solution to generate the page in memory and add as PDF attachment. Wrote small class (below) for testing and run it from the developer console.
When I run it for small data all is fine and its working.
But if I try it with huge data then, for some wired reason, I see that the page being generated over and over every minute (I see every minute call in the developer console), and add attachment per each run.

If I try it with very huge amount of the data, then also the page being generated every minute, but no pdf attachment is created (also can see internal error exception but without other information).

At first, I thought it's something in the code, but as it is working fine for small set of data, I'm thinking it's something internal for SF? Maybe someone have idea for this behavior?
+ Any other suggestions to enhance this process- to support huge data - will be welcome (I don't think it's related to crappy or un standard code, it's simply too much data, so I'm looking for general approach for this)

Thanks.

global class AddPdfToRecord{
   
    webservice static void addPDF(){
      
       pageReference pdf = Page.RepTestLiron;
      
      
       pdf.getParameters().put('cfr','test');
       pdf.getParameters().put('cto','');
       pdf.getParameters().put('del','');
       pdf.getParameters().put('efcont','A');;
       pdf.getParameters().put('hv','A');
       pdf.getParameters().put('repid','a1zD0000000L6WmIAK');
      
       system.debug('URL: ' + pdf.getURL());

       Attachment attach = new Attachment();
       Blob body;
       try
       {
           body = pdf.getContentasPDF();
       }
       catch(Exception e)
       {system.debug('EEEEEEEEEEEEEEEE'  + e) ;}
       attach.Body = body;
       attach.Name = 'FMR_TEST.pdf';
       attach.IsPrivate = false;
       attach.ParentId = '001D000000wqkSY';
           
        
        
       insert attach ;
    }
}

Hello,

 

I have list of records in page with checkbox on each (with wrapper class).

I'm trying to write with JQuery that only one record will be selected at time.

 

Can someone advise what wrong with below script?

It's seems that this script update the wrong data + changing the order in the list...

 

<script>
        var j$ = jQuery.noConflict();
        jQuery(document).ready(function() {
jQuery(".selected-checkbox").click(function() {
var checkedRow = this;
        //alert('Hello world, part 2!'+ checkedRow );
 jQuery(".selected-checkbox").each(
            function() {
                this.checked= false;
            }
        );
checkedRow.checked= true;

});
});
     
</script>

Hello,

 

Is there any way to get the first line from long text field without writing a trigger?

 

I read somewhere that formula function cannot detect break line, so maybe with workflow rule or any other solution?

Hi ,

 

I am very new to this. I need a solution and ideas regarding this issue. I will brief out clearly(I believe). I had an existing email templetae. I have got nothing to do with it but to change the header logo.

 

For this I got intial suggestion is To create a visualforce page and a controller to show the header dynamically on the email template depending on the user country code.

 

I have no way to Go. As of now my thought process is create let us say 4 different logos in static resources and create a visua force component for image with a condition of if country code is such then the image orheader should be such. And then call this vf component in  the email template.

 

I need suggestions and solution quickly please.

I'm having problem to code the test for the following trigger code that automatically generate relatedlist according to a value of a picklist. Until now it's with 75% code coverage.

 

trigger AddRelatedList on Obj1__c (after update) {
    List<Obj2__c> listRisks = new List<Obj2__c>();
    List<Obj3__c> listChecks = new List<Obj3__c>();
    
    //Assign the context before and after the change into a Map
    Map<Id, Obj1__c> newStatusMap = Trigger.newMap;
	Map<Id, Obj1__c> oldStatusMap = Trigger.oldMap;

	//Loop through the map
	for(Id itemId:newStatusMap.keySet()){
		Obj1__c myNewItem = newStatusMap.get(itemId);
		Obj1__c myOldItem = oldStatusMap.get(itemId);
		
		if (myNewItem.F_O__c <> myOldItem.F_O__c){
		    for (Obj1__c a : Trigger.new) {
		    	if(a.F_O__c == 'Firm'){        
			        Obj2__c clt = new Obj2__c(Line_Item__c = a.Id);
			        listRisks.add(clt);
			        
			        Obj3__c clt2 = new Obj3__c(Line_Item__c = a.Id);
			        listChecks.add(clt2);
		        }
		    }		   
		 }
	}
    insert listRisks;
    insert listChecks;
}

 It's with these 4 lines not tested:

 

Obj2__c clt = new Obj2__c(Line_Item__c = a.Id);
listRisks.add(clt);
			        
Obj3__c clt2 = new Obj3__c(Line_Item__c = a.Id);
listChecks.add(clt2);

 

Anyone knows how to help?