• RajaMohan
  • NEWBIE
  • 75 Points
  • Member since 2010
  • Creation Technology Solutions

  • Chatter
    Feed
  • 3
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 37
    Replies
A previous developer installed an unmanaged package from the AppExchange called Custom Quote Sync (Unmanaged).
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.
I have below requirement in analytics graph. i want the user to pass the filters to the graph in VF page. cusyear and cusmonth are the filters used in report graph currently set to blank
    User-added image

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
Hi,
 How generate report on first time logged users in salesforce.it's very urgent any one please assist.

Thanks Advance:)

Regards,
Venu
Hi,

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,

User-added image

Thanks,

Raja
I am adding a trigger to default a Contact owner to the Account owner. It works fine and passes the test I wrote for it. HOWEVER, it fails a test from another piece of apex, telling me:

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:

trigger reassignCtOwnerToAcOwner on Contact (before insert, before update) {

    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:

public static testMethod void validateContactCountsAndActivities() {

        //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;



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

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.

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

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

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

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

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

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;
}

}

 

 

 

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