• Web-pass
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies

Hello,

 

I have a Detailed Page Button, which onClick runs JavaScript and calls out a method inside a global class. Here is the code for that:

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}

sforce.apex.execute( "EmailInvoiceController", "emailinvoice", {invid:"{! Invoice__c.Id }"});

 

The global class EmailInvoiceController is as follows.

 

global class EmailInvoiceController
{
    @future(callout=true)
    webservice static void emailinvoice(ID invid)
    {
// code which fetches the Visualforce page and emails a pdf
}
}

It works perfectly fine and i get an email with a pdf attachment when the button is clicked. Now i run a trigger that calls this method every time a record is inserted. The problem i am facing here is that the email that i receive due to the trigger has a pdf attachment which is malformed and cannot be opened. Also the size of the attachment is reduced to 1.1 kb from the expected 20 kb.

 

I have not changed the code whatsoever and the same code gives perfect results on button click, but not when the method is called from a trigger.

 

Any directions on this issue are highly appreciated.

 

Thanks !!

- P 

 

 

Hello,

 

I am relatively new to Apex and Visualforce and need some guidance.

 

I have 2 objects: Billing Account and Line Items. For every Account, there can be multiple Billing Accounts each of which can have multiple Line Items. I want to return a List from a function that will give me all the Line Items of all Billing Accounts in one single list. This code compiles but on running the code, it gives me an error

 

System.NullPointerException: Attempt to de-reference a null object at line

totallines.addAll(lines);
Please help my cause by suggesting what may be causing this problem. Thanks !!

 

Here is my apex class snippet: 

 

List<Line_Items__c> l, lines, totallines;
List<Billing_Account__c> billacc;   
public List<Line_Items__c> getLineItems()
    {
        if(invoice.Billing_Account__c != null) 
        {
            l = [select id, name, Plan__c, Rate__c, Quantity__c, Total_Value__c, Activation_Date__c, Plan_Name__c, Street__c,
Unit__c, City__c from Line_Items__c where Service_Account__c =: invoice.Billing_Account__c and Status__c =: 'Active'];
           
return l;
                       
        }
        else
        { 
            billacc = [select id, Bill_Street__c, Bill_Unit_Number__c, Bill_City__c, Bill_State__c, Bill_Postal_Code__c from Billing_Account__c 
                                    where Account__c =: invoice.Account__c];
            
            integer z = 0;  
            if(billacc.size() > 0)
            {                      
                for(integer k =0; k < billacc.size(); k++)
                {
                   lines = [select id, name, Plan__c, Rate__c, Quantity__c, Total_Value__c, Activation_Date__c, Plan_Name__c,
Street__c, Unit__c, City__c from Line_Items__c where Service_Account__c =: billacc[k].id and Status__c =: 'Active'];

                   for( integer h = 0; h < lines.size(); h++)
                   {
                       totallines.addAll(lines);
                       z++;
                   }

                }
                 
                 return totallines;
             }
             
             return null;
             
         } 
                                      
    }

Hello,

 

I was looking for some cron job options in Apex and  i came across CronTrigger. But i cannot find any examples or references for CronTrigger. Can anyone please provide me some examples of CronTrigger.

 

Thanks,

Hi,

 

I have created few custom objects for the Salesforce Platform and deployed them. I can see those objects as tabs as an Admin, but for any other user they cannot see that. Even in the Customize My Tabs, i cannot see these objects. I have added these objects to the App Setup, I have changed the visibilty ON for every object as well. The only thing that i can see is that on Setup > Manage Users > Profiles ...for the Standard User profile and Platform profile i see that the custom objects are unchecked. And i cannot find a way to check them even as an Admin. Can some one please suggest any method by which i can have the non-administrators view and use this Custom Object/Tab.

 

Thanks,

Pratik

Hello. I am trying to figure out a way to copy/clone data from one object to another and was wondering if this is possible with a formula?  We have a custom app for billing and I need to input all of our clients e-mail addresses in the respective field for that object. Each of the 'billing accounts' is linked to the Salesforce account + contact objects and the clients e-mail is in the contact object.  Is there a formula that can be created to match/link the billing account to contact and copy the data across? Any help or other advice is greatly appreciated. Thank you!

Hi,

 

I have an Apex class in the sandbox environment. How to deploy this to production environment from Salesforce interface? Please guide me on this. Your help is greatly appreciated.

  • August 11, 2010
  • Like
  • 0

Hello,

 

I have a Detailed Page Button, which onClick runs JavaScript and calls out a method inside a global class. Here is the code for that:

 

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}

sforce.apex.execute( "EmailInvoiceController", "emailinvoice", {invid:"{! Invoice__c.Id }"});

 

The global class EmailInvoiceController is as follows.

 

global class EmailInvoiceController
{
    @future(callout=true)
    webservice static void emailinvoice(ID invid)
    {
// code which fetches the Visualforce page and emails a pdf
}
}

It works perfectly fine and i get an email with a pdf attachment when the button is clicked. Now i run a trigger that calls this method every time a record is inserted. The problem i am facing here is that the email that i receive due to the trigger has a pdf attachment which is malformed and cannot be opened. Also the size of the attachment is reduced to 1.1 kb from the expected 20 kb.

 

I have not changed the code whatsoever and the same code gives perfect results on button click, but not when the method is called from a trigger.

 

Any directions on this issue are highly appreciated.

 

Thanks !!

- P 

 

 

Hello,

 

I am relatively new to Apex and Visualforce and need some guidance.

 

I have 2 objects: Billing Account and Line Items. For every Account, there can be multiple Billing Accounts each of which can have multiple Line Items. I want to return a List from a function that will give me all the Line Items of all Billing Accounts in one single list. This code compiles but on running the code, it gives me an error

 

System.NullPointerException: Attempt to de-reference a null object at line

totallines.addAll(lines);
Please help my cause by suggesting what may be causing this problem. Thanks !!

 

Here is my apex class snippet: 

 

List<Line_Items__c> l, lines, totallines;
List<Billing_Account__c> billacc;   
public List<Line_Items__c> getLineItems()
    {
        if(invoice.Billing_Account__c != null) 
        {
            l = [select id, name, Plan__c, Rate__c, Quantity__c, Total_Value__c, Activation_Date__c, Plan_Name__c, Street__c,
Unit__c, City__c from Line_Items__c where Service_Account__c =: invoice.Billing_Account__c and Status__c =: 'Active'];
           
return l;
                       
        }
        else
        { 
            billacc = [select id, Bill_Street__c, Bill_Unit_Number__c, Bill_City__c, Bill_State__c, Bill_Postal_Code__c from Billing_Account__c 
                                    where Account__c =: invoice.Account__c];
            
            integer z = 0;  
            if(billacc.size() > 0)
            {                      
                for(integer k =0; k < billacc.size(); k++)
                {
                   lines = [select id, name, Plan__c, Rate__c, Quantity__c, Total_Value__c, Activation_Date__c, Plan_Name__c,
Street__c, Unit__c, City__c from Line_Items__c where Service_Account__c =: billacc[k].id and Status__c =: 'Active'];

                   for( integer h = 0; h < lines.size(); h++)
                   {
                       totallines.addAll(lines);
                       z++;
                   }

                }
                 
                 return totallines;
             }
             
             return null;
             
         } 
                                      
    }

Hello,

 

I was looking for some cron job options in Apex and  i came across CronTrigger. But i cannot find any examples or references for CronTrigger. Can anyone please provide me some examples of CronTrigger.

 

Thanks,

Hi,

 

I have created few custom objects for the Salesforce Platform and deployed them. I can see those objects as tabs as an Admin, but for any other user they cannot see that. Even in the Customize My Tabs, i cannot see these objects. I have added these objects to the App Setup, I have changed the visibilty ON for every object as well. The only thing that i can see is that on Setup > Manage Users > Profiles ...for the Standard User profile and Platform profile i see that the custom objects are unchecked. And i cannot find a way to check them even as an Admin. Can some one please suggest any method by which i can have the non-administrators view and use this Custom Object/Tab.

 

Thanks,

Pratik