-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
5Replies
Issue with emailing PDF attachment
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
-
- Web-pass
- August 11, 2010
- Like
- 0
- Continue reading or reply
System.NullPointerException: Attempt to de-reference a null object
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;
}
}
-
- Web-pass
- August 09, 2010
- Like
- 0
- Continue reading or reply
Need help with CronTrigger
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,
P
-
- Web-pass
- July 14, 2010
- Like
- 0
- Continue reading or reply
Cannot see Custom Tabs as Non-Administrator
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
-
- Web-pass
- May 26, 2010
- Like
- 0
- Continue reading or reply
Formula that will copy data from one custom object field to another?
-
- Web-pass
- December 08, 2009
- Like
- 0
- Continue reading or reply
deploy Apex code to production
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.
- Rima
- August 11, 2010
- Like
- 0
- Continue reading or reply
Issue with emailing PDF attachment
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
- Web-pass
- August 11, 2010
- Like
- 0
- Continue reading or reply
System.NullPointerException: Attempt to de-reference a null object
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;
}
}
- Web-pass
- August 09, 2010
- Like
- 0
- Continue reading or reply
Need help with CronTrigger
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,
P
- Web-pass
- July 14, 2010
- Like
- 0
- Continue reading or reply
Cannot see Custom Tabs as Non-Administrator
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
- Web-pass
- May 26, 2010
- Like
- 0
- Continue reading or reply