- RajaMohan
- NEWBIE
- 75 Points
- Member since 2010
- Creation Technology Solutions
-
ChatterFeed
-
3Best Answers
-
3Likes Received
-
0Likes Given
-
26Questions
-
37Replies
Case Feed Layout - Move Save link
I am using Case - Feed Layout for more actions. In the last release under Answer Customer tab, Salesforce moved the Discard Draft | Save links near to Send Email button. This is causing more issues with the end users. Is there any way to move Discard Draft | Save link away from there?
Please look into the below image,
Thanks,
Raja
-
- RajaMohan
- October 24, 2014
- Like
- 0
- Continue reading or reply
Custom Login for Company Community User License
I have built a custom login page for my community and redirected the user to the community by passing the username and password directly like,
https://test.salesforce.com?pw=TestPassword&startURL=/recordID&un=testusername@test.com
I have not used Site.login because, I am not using Portal license. I am using Company Community License to login to the community.
On Successful login, it takes the user to the Community login page but on unsuccessfull login, it takes the user to the standard test/login page. This is affecting the branding and flow.
Is there any way to login to community by checking the username and password of the user without affecting the branding?
Thanks
Reagrds
Raja
-
- RajaMohan
- September 04, 2014
- Like
- 0
- Continue reading or reply
Custom Login Page for Internal Community Users
I want a cusom Login page for the Internal Community users. The Site.Login(username,password) is not working for the internal users. Instaead of following the Log in here link on the community page, I want a way to accomplish it using custom login page.
Any ideas or help will be more appreciated.
Thanks
Regards
Raja
-
- RajaMohan
- August 07, 2014
- Like
- 0
- Continue reading or reply
Dynamic SOQL to query list of sObjects at once
I am trying to query differnt sObjects like Account, Contact, Opportunity and two other custom objects in an instant. If any of the record is related to any other object then I am taking it dynamicaly and querying that particular record ID.
The problem is, The queries are coming under for loop at the moment. I am wondering if there is any chance to query the list of sObjects in a single query to avoid this.
Please suggest me a way to proceed with this.
Thanks
Raja
-
- RajaMohan
- January 27, 2014
- Like
- 0
- Continue reading or reply
Moving the live chat window to bottom right
Hi folks,
How to open up the live chat window on the bottom right corner of the window?
In my application, If I start the chat from the browser then it is opening a new window on the top left corner. I want this to appear on bottom right of the page. I have searched a lot for doing this. I did not get any idea. Please suggest me a solution to do this.
Thanks in advance
Regards
Raja
-
- RajaMohan
- November 19, 2013
- Like
- 0
- Continue reading or reply
Displaying Google Chart - Background color is not coming up
Hi All,
I have writtena VF page which displays the Google bar chart on the top of the page and the respective values as tables in the below. I have applied some background colors inside the table for some particular values.
Since the chart will not display on the pdf page, I used IFRAME to call to display the standard print dialog box to save the page as PDF. In this scenario, If I can able to see the chart but the background colors are not coming up. If I take the chart code out of the VF page then I can see the background color of the page.
What is the reason behind this? Also, Please give me any solution to display both the things.
Thanks
Raja
-
- RajaMohan
- January 21, 2013
- Like
- 0
- Continue reading or reply
Getting the background color in PDF page
Hi All,
I am rending a visualforce page as pdf. I want to highlight some of the rows dynamically by different color. The page code is working fine in the browser. While I try to save the same page as pdf then it is not loading the background color for that row. I have written a css style sheet for this and then I am accessing it inside the page.
Please, guide me to add the background color in the pdf page.
Thanks
Raja
-
- RajaMohan
- January 15, 2013
- Like
- 0
- Continue reading or reply
How to display a small box using Java Script or jQuery?
Hi All,
I created a VF page which has a text box called City. It is a normal text box. When ever the user enter a character, I want a small text box to populate the existing cities starting with that character and it goes on with the next character. The user can able to select the city from the text box which appears after entering a character. The cities is a custom object.
Anyone, please suggest me how do I do this?
Any examples will be highly appreciated.
Thanks
Raja
-
- RajaMohan
- December 10, 2012
- Like
- 0
- Continue reading or reply
how to do Sagepay Integration using apex?
Hi All,
Did anyone do SagePay Integration using apex? I want to implement it for my client. I got the document from SagePay. The request format is only given in the document. The way to do the encryption and sending the request are not provided over there.
Please help me out to complete this.
Thanks
Raja
-
- RajaMohan
- December 06, 2012
- Like
- 2
- Continue reading or reply
How to decode the PDF?
Hi Folks,
I am getting a pdf/word/excel file from the System and storing the binary information in a separate object. When I try to decode it in the attachment it is decoding in the right format but the file is not opening. It is giving Failed to open the pdf documnet error.
//In a separate method
fileBody=EncodingUtil.base64Encode(myfile.body);
DateTime todayDate=datetime.now();
ts=todayDate.format('yyyyMMddHHmmss');
Decimal ord=0.0;
List<Attachment_Creation__c> attList=new List<Attachment_Creation__c>();
while(fileBody!=null){
String str;
Attachment_Creation__c attcre=new Attachment_Creation__c();
if(fileBody.length()>32000){
str=fileBody.substring(0,32000);
filebody=fileBody.substring(32001);
attcre.File_Body__c=str;
attcre.Timestamp__c=ts;
attcre.Order__c=ord++;
attList.add(attcre);
}
else {
str=fileBody.substring(0);
attcre.File_Body__c=str;
attcre.Timestamp__c=ts;
attcre.Order__c=ord++;
attList.add(attcre);
fileBody=null;
}
}//while ends
if(attList.size()>0)
insert attList;
And, In the save method,
transient List<Attachment_Creation__c> att=[select Timestamp__c,File_Body__c,Order__c from Attachment_Creation__c where Timestamp__c=:ts order by Order__c asc];
String b='';
if(renderAttachmentSec && att.size()>0){
Attachment a = new Attachment(parentId = createAction.id, name=myfile.name);
for(Attachment_Creation__c sa:att){
b=b+sa.File_Body__c;
}
System.debug('£££ Body Save : '+b);
if(a.Name.contains('pdf')){
a.Name=a.Name+'.pdf';
a.ContentType='application/pdf';
// Blob bb=Blob.valueOf(b.trim());
// String s=EncodingUtil.base64Encode(bb);
a.Body=EncodingUtil.base64Decode(b.trim());
}
The reason I am doing in this way is, to avoid the View state issue. Please explain the right way to decode it and open the pdf.
Thanks
Raja
-
- RajaMohan
- December 03, 2012
- Like
- 0
- Continue reading or reply
How to navigate to the edit page dynamically?
Hi Folks,
From the controller, I need to navigate to the Employee page dynamically by clicking a 'New Employee' button.
I can hardcode like '/a0F/', but i need this to happen dynamically since I am going to create a managed package the key prefix can vary.
Also, I like to populate some of the custom filed values from the controller. How to get the field ID's dynamically for the same.
If you provide some useful information then it will be more helpful. If possible, give me some code examples.
Thanks
Raj
-
- RajaMohan
- July 21, 2011
- Like
- 0
- Continue reading or reply
How to enable Single Sign on?
Hi Folks,
I am trying to integrate a website into salesforce.com platform based on their profile using the SSO. I have read some of the related sites to do this, but i am struggling in doing this.
Can anyone help me by providing the right way to implement this?
Thanks
Raja
-
- RajaMohan
- May 16, 2011
- Like
- 0
- Continue reading or reply
Help needed for VF Snippet
Hi Folks,
I have changed the Account as Companies now. I just want the list of companies as a picklist value in another object called Company Schemes. I just tried of using the VF snippet and added the same into the page layout. But It did not populate the values. Please help me by giving the relavent idea on this. Some codes will be much helpful.
Thanks
Raj
-
- RajaMohan
- March 15, 2011
- Like
- 0
- Continue reading or reply
How to cover the test coverage?
Hi Folks,
I am unable to cover the parts which is marked in red in test coverage. Please help me in covering these parts. It is very urgernt.
public PageReference EmailQuote(){
try
{
PageReference pcd = Page.esc_Quote;
pcd.getParameters().put('id',Oppr.id);
Blob pdfBlob = pcd.getContent();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
String [] toAddresses = new String[] {SearchTo};
String [] toCC = new String[] {SearchCC};
String [] toBCC = new String[] {SearchBCC};
str1=SearchBody.replaceAll('\n','<br/>');
if(Acc.RecordTypeId=='0122000000058UW' || Acc.RecordTypeId=='01220000000HS25'){
Contact cc=[select id,name,Email from contact where id=:oppr.contact__c];
if(cc.Email != null){
email.setTargetObjectId(cc.Id);
email.setSubject(SearchSubject);
email.setHtmlBody(str1);
if(SearchCC!=''){
email.setCcAddresses(toCC);
}
if(SearchBCC!=''){
email.setBccAddresses(toBCC);
}
email.setSaveAsActivity(true);
// Create an email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('ES_'+ Oppr.Quote_Number__c+'-'+ Oppr.Quote_Version__c + '.pdf');
efa.setBody(pdfBlob); //attach the PDF
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
//Create an event.
Task myTask = new Task();
myTask.WhatId = Oppr.Id;
myTask.WhoId = cc.Id;
myTask.IsReminderSet = true;
myTask.ReminderDateTime = System.Today();
myTask.ActivityDate = System.Today();
myTask.Description = SearchBody;
myTask.Subject = SearchSubject;
myTask.OwnerId = Usr.Id;
myTask.Status = 'Completed';
Insert myTask;
}
else{
email.setSaveAsActivity(false);
email.setTargetObjectId(usr.Id);
email.setSubject('No Email to send the Quotation');
email.setHtmlBody('Dear '+usr.Name+', No Email ID found into the Contact to send the Quotation.');
}
}
if(Acc.RecordTypeId=='0122000000058cV'){
//email.setTargetObjectId(Con.Id);
email.setSubject(SearchSubject);
email.setHtmlBody(str1);
email.setToAddresses(toAddresses);
if(SearchCC!=''){
email.setCcAddresses(toCC);
}
if(SearchBCC!=''){
email.setBccAddresses(toBCC);
}
email.setSaveAsActivity(true);
//Create an email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('ES_'+ Oppr.Quote_Number__c+'-'+ Oppr.Quote_Version__c + '.pdf');
efa.setBody(pdfBlob); //attach the PDF
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
//Create an event.
Task myTask = new Task();
myTask.WhatId = Oppr.Id;
myTask.WhoId = con.Id;
myTask.IsReminderSet = true;
myTask.ReminderDateTime = System.Today();
myTask.ActivityDate = System.Today();
myTask.Description = SearchBody;
myTask.Subject = SearchSubject;
myTask.OwnerId = Usr.Id;
myTask.Status = 'Completed';
Insert myTask;
}
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
Pagereference OppPage = new ApexPages.StandardController(Oppr).view();
opppage.setredirect(true);
return OppPage;
}catch(Exception e){
System.debug('ERROR:' + e);
return null;
}
}
-
- RajaMohan
- March 10, 2011
- Like
- 0
- Continue reading or reply
How to add time dependent workflow in the managed packages?
Hi All,
I have created a managed package. In that, I am unable to add the time dependent workflow. Will anyone help me in resoving this issue?
I also installed that package and tired adding the same in the new environment. This also not helped me.
Please give me, some good ideas.
Thanks
Raj
-
- RajaMohan
- February 16, 2011
- Like
- 0
- Continue reading or reply
How to resolve the Too many DML statements: 151 error??
hi folks,
I have written a trigger and caling a class from that. It is working fine for new records. If I use data loader then It is throwing me the followig error.
Too many DML statements: 151
How to resolve this error??
Thanks
Raj
-
- RajaMohan
- January 28, 2011
- Like
- 0
- Continue reading or reply
How to map the list and Id
Hi Folks,
How to map a ld with the list and display the same in the VF page??
For Eg:
Map<id,List<object__c>> obj=new Map<id,List<object__c>>();
Now, I want the fields in the object__c to be displayed in the VF page and want to update the same field via VF page.
Any examples will be helpful..
Thanks
Raj
-
- RajaMohan
- December 20, 2010
- Like
- 0
- Continue reading or reply
Attempt to de-reference a null object
Hi
while I am uploading the data from dataloader I am getting the following error.
ContractPremiumUpdate: execution of AfterUpdate
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.ContractPremiumUpdate: line 38, column 8
Code:
trigger ContractPremiumUpdate on Contract ( after update) {
Set<Id> accid = new Set<Id>();
// List<Account> listacc = new List<Account>();
for (Contract c : Trigger.new) {
accid.add(c.AccountId);
}
//listacc.clear();
Map<ID,Account> listacc = new Map<ID,Account>{}; //NOTE: NOW, WE ARE INSTANTIATING A MAP, INSTEAD OF A LIST
Map<ID,Account> acc = new Map<ID, Account>([Select a.Id,a.Premiumaccount__c, a.Name From Account a where a.id IN :accid limit 1 ]);
// Account acc = [Select a.Premiumaccount__c, a.Name, a.Id From Account a where a.id IN :accid limit 1 ];
for (Integer i=0;i<trigger.new.size();i++){
if((trigger.new[i].Post_Deal_Qualit_t__c == 'Gold' ||
trigger.new[i].Post_Deal_Qualit_t__c == 'Silber' ||
trigger.new[i].Post_Deal_Qualit_t__c == 'Platin'))
{
Account tmpLead = acc.Get(trigger.new[i].AccountId);
tmpLead.Premiumaccount__c = 'Premium Partner';
listacc.put(tmpLead.id,tmpLead);
}
}
update listacc.values();
}
Kindly help me in this. This is very urgent.
Thanks
Raj
-
- RajaMohan
- September 13, 2010
- Like
- 0
- Continue reading or reply
New column in Task View
Hi
I just need one more column in the task view in the home page layout. Now it is displaying the standard columns in the home page at the bottom right. I need to add comments column into that. How to do this?
Thanks
Raj
-
- RajaMohan
- September 13, 2010
- Like
- 0
- Continue reading or reply
Need to display if records present.
Hi
In my VF page, I am printing all the output from the controller. It is printing fine. I am printing the values for more objs. Some of the objs may be empty and some of the objs may contain value. I need to display the obj values which are having the values in it.
Sample code:
<table align="center" width=95%>
<tr colspan="5"><th>Fund Series Share Classes</th></tr>
<tr>
<th>Share Class Code</th><th>Series Share Class Type</th>
<th>Share Class Launch Date</th><th>Version</th>
<th>Status</th>
<apex:repeat value="{!allFund}" var="fund">
<tr>
<td>{!fund.Share_Class_Code__c}</td>
<td>{!fund.Series_Share_Class_Type__c}</td>
<td>{!fund.Share_Class_Launch_Date__c}</td>
<td>{!fund.Version__c}</td>
<td>{!fund.Status__c}</td>
</tr>
</apex:repeat>
</table>
The problem is, Any how the header row is created if the {!allFund} is empty.
Thanks
Raj
-
- RajaMohan
- September 07, 2010
- Like
- 0
- Continue reading or reply
how to do Sagepay Integration using apex?
Hi All,
Did anyone do SagePay Integration using apex? I want to implement it for my client. I got the document from SagePay. The request format is only given in the document. The way to do the encryption and sending the request are not provided over there.
Please help me out to complete this.
Thanks
Raja
-
- RajaMohan
- December 06, 2012
- Like
- 2
- Continue reading or reply
How to display alert message using trigger??
Hi,
I am implementing a trigger in Accounts. If some conditions becomes true then I need to display an alert message to the user.
I searched in the discussion boards?? But I didnt find anything reg this.
Is there any way to achieve this?
If so then pls give some examples..
Thanks,
-
- RajaMohan
- July 28, 2010
- Like
- 1
- Continue reading or reply
Change Set Test Execution fails because of an unmanaged package that a previous developer installed. Help?
It is keeping any change sets we try and deploy to Production from being successful because the test triggers are at 0% and total code coverage is only at 64%.
I am completely unfamiliar with test classes and could really use some assistance. I can provide further details if needed.
Thank you in advance,
Here are the Errors:
Code Coverage Failure
Your organization's code coverage is 64%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.QuoteSyncTrigger
QuoteLineSyncTrigger
Component Errors
API Name
Type
Line
Column
Error Message
0 0 QuoteSyncTestSuite.testCreateDuplicateOppLine(); QuoteSyncTestSuite.testCreateDuplicateQuoteLine(); QuoteSyncTestSuite.testCreateQuote(); QuoteSyncTestSuite.testCreateQuoteWithQuoteLine(); QuoteSyncTestSuite.testInsertOppLineNoSync(); QuoteSyncTestSuite.testInsertOppLineNotSync(); QuoteSyncTestSuite.testInsertOppLineSync(); QuoteSyncTestSuite.testInsertQuoteLineNoSync(); QuoteSyncTestSuite.testInsertQuoteLineNotSync(); QuoteSyncTestSuite.testInsertQuoteLineSync(); QuoteSyncTestSuite.testStartSyncInsertOppLine(); QuoteSyncTestSuite.testStartSyncInsertOppLineSetNull(); QuoteSyncTestSuite.testStartSyncMatchOppLine_1(); QuoteSyncTestSuite.testStartSyncMatchOppLine_1a(); QuoteSyncTestSuite.testStartSyncMatchOppLine_2(); QuoteSyncTestSuite.testSt
0 0 QuoteLineSyncTrigger, Details: Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
0 0 QuoteSyncTrigger, Details: Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
0 0 , Details: Average test coverage across all Apex Classes and Triggers is 64%, at least 75% test coverage is required.
- Bailey Rudd
- August 05, 2015
- Like
- 0
- Continue reading or reply
Analytic graph with user filters
I have tried below
VF code
<apex:page controller="Dashboard" sidebar="false" >
<apex:form ID="Search" > <apex:pageBlock > <apex:pageBlockButtons >
<apex:commandButton value="Submit" action="{!Search}" reRender="showpartner" />
</apex:pageBlockButtons> <apex:outputLabel value="Name:" /> <apex:inputText value="{!Name}"/>
<apex:pageBlockTable value="{!tenpartners }" var="partnervalue" id="showpartner" > <apex:column value="{!partnervalue.syear__c}"/><apex:column ><analytics:reportChart cacheAge="10" cacheResults="false" reportid="00O280000035HWm" size="large" filter="{column:'SYEAR', operator:'equals', value:'{!JSENCODE(partnervalue.Name)}'}">
</analytics:reportChart></apex:column> </apex:pageblockTable> </apex:pageBlock> </apex:form></apex:page>
Controller
public class Dashboard{
Public List<opportunity> tenpartners{get;set;}
public string Name{get;set;}
public Boolean rend { get; set; }
public pagereference search(){
tenpartners = new List<opportunity>();
tenpartners = database.query('SELECT ID,cusmonth__c,syear__c,Name FROM opportunity where syear__c=:Name');
return null;}}
I am gettnig below error when executed
[For the filter 1: Specify a valid filterable column because SYEAR is invalid.]
is thre any other way to achieve it? Please help
- antony fernando 17
- August 05, 2015
- Like
- 0
- Continue reading or reply
"%Users logged in 1st time"
How generate report on first time logged users in salesforce.it's very urgent any one please assist.
Thanks Advance:)
Regards,
Venu
- bvc
- August 05, 2015
- Like
- 0
- Continue reading or reply
Case Feed Layout - Move Save link
I am using Case - Feed Layout for more actions. In the last release under Answer Customer tab, Salesforce moved the Discard Draft | Save links near to Send Email button. This is causing more issues with the end users. Is there any way to move Discard Draft | Save link away from there?
Please look into the below image,
Thanks,
Raja
- RajaMohan
- October 24, 2014
- Like
- 0
- Continue reading or reply
Data changed by trigger for field Owner ID: owner cannot be blank
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, reassignCtOwnerToAcOwner: data changed by trigger for field Owner ID: owner cannot be blank: []
Here is the trigger I'm trying to deploy:
List<Id> accountIds = new List<Id>();
Map<Id, Id> accountOwnerIdMap = new Map<Id, Id>();
// all the accounts whose owner ids to look up
for ( Contact c : Trigger.new ) {
accountIds.add( c.accountId );
}
// look up each account owner id
for ( Account acct : [ SELECT id, ownerId FROM account WHERE id IN :accountIds ] ) {
accountOwnerIdMap.put( acct.id, acct.ownerId );
}
// change contact owner to its account owner
for ( Contact c : Trigger.new ) {
c.ownerId = accountOwnerIdMap.get( c.accountId );
}
}
Here is the test class for the OTHER trigger that fails when I try to insert a contact:
//Create Account
Account ac = new Account(
Name='Test Account',
Initial_Lead_Source__c='Cold Call',
Initial_Lead_Source_Detail__c='Cold Call',
Account_Type__c='Prospect',
Account_Status__c='Not Contacted' );
insert ac;
//Create Contact
Contact ct = new Contact(
LastName='Test Contact',
Email='testcontact@email.com',
Account= ac);
insert ct;
- ilewi121
- January 27, 2014
- Like
- 1
- Continue reading or reply
Moving the live chat window to bottom right
Hi folks,
How to open up the live chat window on the bottom right corner of the window?
In my application, If I start the chat from the browser then it is opening a new window on the top left corner. I want this to appear on bottom right of the page. I have searched a lot for doing this. I did not get any idea. Please suggest me a solution to do this.
Thanks in advance
Regards
Raja
- RajaMohan
- November 19, 2013
- Like
- 0
- Continue reading or reply
Creating a CLone functionalities
Hi, I need help to create a clone functionalities on account. Bascially the clone should clone some field. Can we do it with Onclick Javascript? My Visualforce skills in not good. Or if you give me a starting point, I will try to create a clone button. THere are many blogs on this but I didn't find a simple one.
Any help will be really appreciated.
Thanks
AB.
- AB003
- March 21, 2013
- Like
- 0
- Continue reading or reply
Google Map integration with Salesforce
Hello!!
I need help on google map integration with Salesforce. Right now it's working perfectly the only problem is that it's showing only one company along with address. I want to show all the other companies which belong to the same region.
Does anyone know how can we do this. Help is really appreciated. Thanks in advance.
Regards,
Rajiv
- Rajiv
- March 21, 2013
- Like
- 0
- Continue reading or reply
Session settings for visualfoce page
Hi,
How to set the session setting for visualforce login page. My requirement is, i have created one visualforce page as login page. If the user is login with username and password it will be redirect to some other page. user name and password i have stored in some other object. I have checked with that details.
Now my requirement is, if user is in login, after 1 hour i need to display pop up with message as 'your session is expired. Please login again'. How can i solve this. Please help me out.
Thanks,
Rams
- Rams
- March 19, 2013
- Like
- 0
- Continue reading or reply
How to display a small box using Java Script or jQuery?
Hi All,
I created a VF page which has a text box called City. It is a normal text box. When ever the user enter a character, I want a small text box to populate the existing cities starting with that character and it goes on with the next character. The user can able to select the city from the text box which appears after entering a character. The cities is a custom object.
Anyone, please suggest me how do I do this?
Any examples will be highly appreciated.
Thanks
Raja
- RajaMohan
- December 10, 2012
- Like
- 0
- Continue reading or reply
How to decode the PDF?
Hi Folks,
I am getting a pdf/word/excel file from the System and storing the binary information in a separate object. When I try to decode it in the attachment it is decoding in the right format but the file is not opening. It is giving Failed to open the pdf documnet error.
//In a separate method
fileBody=EncodingUtil.base64Encode(myfile.body);
DateTime todayDate=datetime.now();
ts=todayDate.format('yyyyMMddHHmmss');
Decimal ord=0.0;
List<Attachment_Creation__c> attList=new List<Attachment_Creation__c>();
while(fileBody!=null){
String str;
Attachment_Creation__c attcre=new Attachment_Creation__c();
if(fileBody.length()>32000){
str=fileBody.substring(0,32000);
filebody=fileBody.substring(32001);
attcre.File_Body__c=str;
attcre.Timestamp__c=ts;
attcre.Order__c=ord++;
attList.add(attcre);
}
else {
str=fileBody.substring(0);
attcre.File_Body__c=str;
attcre.Timestamp__c=ts;
attcre.Order__c=ord++;
attList.add(attcre);
fileBody=null;
}
}//while ends
if(attList.size()>0)
insert attList;
And, In the save method,
transient List<Attachment_Creation__c> att=[select Timestamp__c,File_Body__c,Order__c from Attachment_Creation__c where Timestamp__c=:ts order by Order__c asc];
String b='';
if(renderAttachmentSec && att.size()>0){
Attachment a = new Attachment(parentId = createAction.id, name=myfile.name);
for(Attachment_Creation__c sa:att){
b=b+sa.File_Body__c;
}
System.debug('£££ Body Save : '+b);
if(a.Name.contains('pdf')){
a.Name=a.Name+'.pdf';
a.ContentType='application/pdf';
// Blob bb=Blob.valueOf(b.trim());
// String s=EncodingUtil.base64Encode(bb);
a.Body=EncodingUtil.base64Decode(b.trim());
}
The reason I am doing in this way is, to avoid the View state issue. Please explain the right way to decode it and open the pdf.
Thanks
Raja
- RajaMohan
- December 03, 2012
- Like
- 0
- Continue reading or reply
Help needed for VF Snippet
Hi Folks,
I have changed the Account as Companies now. I just want the list of companies as a picklist value in another object called Company Schemes. I just tried of using the VF snippet and added the same into the page layout. But It did not populate the values. Please help me by giving the relavent idea on this. Some codes will be much helpful.
Thanks
Raj
- RajaMohan
- March 15, 2011
- Like
- 0
- Continue reading or reply
How to cover the test coverage?
Hi Folks,
I am unable to cover the parts which is marked in red in test coverage. Please help me in covering these parts. It is very urgernt.
public PageReference EmailQuote(){
try
{
PageReference pcd = Page.esc_Quote;
pcd.getParameters().put('id',Oppr.id);
Blob pdfBlob = pcd.getContent();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
String [] toAddresses = new String[] {SearchTo};
String [] toCC = new String[] {SearchCC};
String [] toBCC = new String[] {SearchBCC};
str1=SearchBody.replaceAll('\n','<br/>');
if(Acc.RecordTypeId=='0122000000058UW' || Acc.RecordTypeId=='01220000000HS25'){
Contact cc=[select id,name,Email from contact where id=:oppr.contact__c];
if(cc.Email != null){
email.setTargetObjectId(cc.Id);
email.setSubject(SearchSubject);
email.setHtmlBody(str1);
if(SearchCC!=''){
email.setCcAddresses(toCC);
}
if(SearchBCC!=''){
email.setBccAddresses(toBCC);
}
email.setSaveAsActivity(true);
// Create an email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('ES_'+ Oppr.Quote_Number__c+'-'+ Oppr.Quote_Version__c + '.pdf');
efa.setBody(pdfBlob); //attach the PDF
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
//Create an event.
Task myTask = new Task();
myTask.WhatId = Oppr.Id;
myTask.WhoId = cc.Id;
myTask.IsReminderSet = true;
myTask.ReminderDateTime = System.Today();
myTask.ActivityDate = System.Today();
myTask.Description = SearchBody;
myTask.Subject = SearchSubject;
myTask.OwnerId = Usr.Id;
myTask.Status = 'Completed';
Insert myTask;
}
else{
email.setSaveAsActivity(false);
email.setTargetObjectId(usr.Id);
email.setSubject('No Email to send the Quotation');
email.setHtmlBody('Dear '+usr.Name+', No Email ID found into the Contact to send the Quotation.');
}
}
if(Acc.RecordTypeId=='0122000000058cV'){
//email.setTargetObjectId(Con.Id);
email.setSubject(SearchSubject);
email.setHtmlBody(str1);
email.setToAddresses(toAddresses);
if(SearchCC!=''){
email.setCcAddresses(toCC);
}
if(SearchBCC!=''){
email.setBccAddresses(toBCC);
}
email.setSaveAsActivity(true);
//Create an email attachment
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('ES_'+ Oppr.Quote_Number__c+'-'+ Oppr.Quote_Version__c + '.pdf');
efa.setBody(pdfBlob); //attach the PDF
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
//Create an event.
Task myTask = new Task();
myTask.WhatId = Oppr.Id;
myTask.WhoId = con.Id;
myTask.IsReminderSet = true;
myTask.ReminderDateTime = System.Today();
myTask.ActivityDate = System.Today();
myTask.Description = SearchBody;
myTask.Subject = SearchSubject;
myTask.OwnerId = Usr.Id;
myTask.Status = 'Completed';
Insert myTask;
}
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
Pagereference OppPage = new ApexPages.StandardController(Oppr).view();
opppage.setredirect(true);
return OppPage;
}catch(Exception e){
System.debug('ERROR:' + e);
return null;
}
}
- RajaMohan
- March 10, 2011
- Like
- 0
- Continue reading or reply
How to add time dependent workflow in the managed packages?
Hi All,
I have created a managed package. In that, I am unable to add the time dependent workflow. Will anyone help me in resoving this issue?
I also installed that package and tired adding the same in the new environment. This also not helped me.
Please give me, some good ideas.
Thanks
Raj
- RajaMohan
- February 16, 2011
- Like
- 0
- Continue reading or reply