• Sfdc Cloud
  • NEWBIE
  • 420 Points
  • Member since 2014
  • Salesforce Consultant

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 73
    Replies
Hi Experts,

My test class is failing and I can't figure out why. Any assistance is greatly appreciated.

This is the error message:

System.QueryException: List has no rows for assignment to SObject

Stack Trace Class.GenerateJobOfferController.<init>: line 6, column 1
                   Class.GenerateJobOfferController_Tests.myUnitTest: line 15, column 1

This is the test class as a whole:
 
@isTest
private class GenerateJobOfferController_Tests {

    static Account objAccount;   
    static Contact objContact;
    static Job_Order__c objJobOrder;
    static Candidate__c objCandidate;
    static Candidate_Applications__c objApplication;
    
   
    static testMethod void myUnitTest() {
        // TO DO: implement unit test
         LoadData();
        ApexPages.StandardController stdController = new ApexPages.StandardController(objApplication);
        GenerateJobOfferController objGenerateJobOfferController = new GenerateJobOfferController(stdController);
       
   }
   
   static void LoadData(){
        createAccount();
        createContact();
        createJobOrder();
        createCandidate();
        createApplication();
        
   }
   
   static void createAccount(){
        objAccount = new Account();
        objAccount.Name = 'Test Account';
        
        insert objAccount;
        
        //assert..........
        Account TempAccount = new Account();
        TempAccount = [select id from Account where id =:objAccount.id];
        system.assertEquals(TempAccount.id == objAccount.id, true);
    }
    static void createContact(){
        objContact = new Contact();
        objContact.LastName = 'Test Contact';
        objContact.email = 'benX585@gmail.com';
        objContact.AccountId = objAccount.id;
        
        insert objContact;
        
        //assert..........
        Contact TempContact = new Contact();
        TempContact = [select id from Contact where id =:objContact.id];
        system.assertEquals(TempContact.id == objContact.id, true);
    }
    
    static void createJobOrder(){
        objJobOrder = new Job_Order__c();
        objJobOrder.Job_Title__c = 'Test Title';
        objJobOrder.Start_Date__c = date.today();
        objJobOrder.End_Date__c = date.today();
        objJobOrder.Status__c = 'Hiring';
        objJobOrder.Contact_Client__c = objContact.id;
        objJobOrder.Salary_Range__c = '123-123';
        objJobOrder.Experience_level_desired__c = 'Student';
        
        insert objJobOrder;
        
        //assert..........
        Job_Order__c TempJobOrder = new Job_Order__c();
        TempJobOrder = [select id from Job_Order__c where id =:objJobOrder.id];
        system.assertEquals(TempJobOrder.id == objJobOrder.id, true);
    }
    static void createCandidate(){
        objCandidate = new Candidate__c();
        objCandidate.Last_Name__c = 'Test Candidate';
                
        insert objCandidate;
        
        //assert..........
        Candidate__c TempCandidate = new Candidate__c();
        TempCandidate = [select id from Candidate__c where id =:objCandidate.id];
        system.assertEquals(TempCandidate.id == objCandidate.id, true);
    }
        
   static void createApplication(){
        objApplication = new Candidate_Applications__c();
        objApplication.Candidate_Status__c = 'New';
        objApplication.Job_Order__c = objJobOrder.id;
        objApplication.Candidate__c = objCandidate.id;
        
        insert objApplication;
        
        //assert..........
        Candidate_Applications__c TempApplication = new Candidate_Applications__c();
        TempApplication = [select id from Candidate_Applications__c where id =:objApplication.id];
        system.assertEquals(TempApplication.id == objApplication.id, true);
    }
    
  }

Thank you in advance.
I'm trying to create a simple trigger on Opportunity that updates a custom field on all related OpportunityLineItems when the Opportunity stage is updated to Closed/Won.  I have this code, but I'm getting an error saying oli variable does not exist.
trigger onOpportunityWon on Opportunity (after update) {
Set<Id> relevantIds = new Set<Id>();
    // select relevant opportunities
    for(Opportunity o : trigger.new)
    {
        if(o.StageName == 'Closed Won' || trigger.oldMap.get(o.Id).StageName == 'Closed Won')
        {
            relevantIds.add(o.Id);
        }
    }

    // Line Items
    for(OpportunityLineItem oli : [SELECT ID, WonWhen__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId IN :relevantIds])
    {
        oli.WonWhen__c = system.today();
    }

if (oli.size()>0)
    update oli.values();
}
What am I doing wrong?  Thank you!
Hi to All
 
I Have one doubt  whenever  we create a record on Account Object , while we enter the Billing Address Field Value  , The same Value as display the Mailing Address Without Clicking the Copy Billing Address to Shipping Address
I Done By using Triggers  by using Before Insert  Event it working
But I want it By using  After Insert Event Can Plse suggest  and give me Explanation also
 
Hi All,

i created Quote Number  Filed With Data Type is Auto Number, Once fill all The fields then Save,  Quote No is Q-00000001 Created and showing  Q-00000001. but my requirement is Customer Product Date Quote No  for Ex: Laptop 23062014 Q-00000001 

How can i resolve This Issue. Pls Help me

Thanks in advance.

  • June 23, 2014
  • Like
  • 0
Example ----When we fullfill contact then opporetunity then two contact role

Action            Contact  Name        Company Name           Email                                                        Phone                           Role                       Primary
Edit |  Del     Mark Sze                  informgroup.com            mark.sze@informgroup.com                                                                                    Checked
Edit | Del       Mark Sze                 informgroup.com            mark.sze@informgroup.com                                                      Buyer                         Checked

_______________________________________________________________________________________
When we fill oportunity then only one contact role ___
Action            Contact  Name        Company Name              Email                                                        Phone                           Role                        Primary
Edit |  Del     Mark Sze                  informgroup.com            mark.sze@informgroup.com                                                                                         Checked

How i solve it and i want to only one contact role in under opportunity







Trigger-------------
________________________
trigger OpportunityTrigger on Opportunity (After insert)
{
    if(trigger.isAfter && trigger.isInsert)
    { system.debug('After insert');
        opportunityTriggerHandler objopportunityTriggerHandler = new opportunityTriggerHandler();
        objopportunityTriggerHandler.createNewContact(trigger.new);
    }
}

________________________________
Class is _______________________________
Public class opportunityTriggerHandler
{
   
    public void createNewContact(List<Opportunity> triggerNew)
    {
        List<OpportunityContactRole> lstOppContactRole = new list<OpportunityContactRole>();
        if(triggerNew != null && triggerNew.size() > 0)
        {
            for(Opportunity objOpp : triggerNew)
            {
                if(objOpp.Buyer__c != null)
                {
                    OpportunityContactRole objOppContactRole = new OpportunityContactRole();
                   
                    objOppContactRole.ContactId = objOpp.Buyer__c;
                    objOppContactRole.OpportunityId = objOpp.ID;
                    objOppContactRole.Role = 'Buyer';
                   
                    lstOppContactRole.add(objOppContactRole );
                }
            }
        }
       
        if(lstOppContactRole.size() > 0)
      
       insert lstOppContactRole;
       
    }
}




Hi,

Am trying to create Line Chart but its not populating anything on VF page.

VF:

<apex:page controller="ChartController" showHeader="false" sidebar="false">
<apex:chart height="400" width="700" data="{!Data}">
<apex:axis type="Numeric" fields="data1" grid="true" title="No. of Opportunities" position="left"  />
<apex:axis type="Category"  fields="name"   grid="true" title="Months"  position="bottom" />
<apex:lineSeries title="abcd" axis="left" xField="name" yField="data1" fill="true"  markerSize="4" markerFill="blue" markerType="cross"/>
</apex:chart>
</apex:page>

Class:
public with sharing class ChartController {
public static List<Data> getData() {
    return ChartController.getChartData();
    }
   
    @RemoteAction
    public static List<Data> getRemoteData() {
        return ChartController.getChartData();
    }
     public static List<Data> getChartData() {
        List<Data> data =new List<Data>();
        data.add(new data('jan',10,20));
        data.add(new data('feb',50,10));
        data.add(new data('march',20,40));
        data.add(new data('june',30,30));
        data.add(new data('april',60,10));
        return data;
    }
   
    public class Data    {
        public String Name{get; set;}
        public Integer data1{get; set;}
        public Integer data2{get; set;}
        public Data(String name, Integer data1, Integer data2)        {
            this.name= name;
            this.data1= data1;
            this.data2= data2;
        }
    }
}
 

Hello
How can I create using the expression values ​​a JOB to run every third Monday of the month?

I tried something, but did not work: 0 30 15 ? * 2#3

Thank you
Hi Guys,

I have enabled the inlineediting functionality  in userInterface and it was working for all the objects except for opportunity detailed view. Could any one help me out to find solution on this.
I have created a custom object in Salesforce, and am trying to get the page to be tested in Salesforce1. I have attached a custom page to the creation of new records. I have marked the page to be "Available for Salesforce mobile apps". As far as I can tell, the object is supposed to be open for anyone to be able to access this object.

I have a colleague, that has full admin rights and can see the object in Salesforce, but cannot find the object in salesforce1. I can see it in my salesforce1 and chatter applications, but no one else can. Additionally, if I provide a link to the mobile version of the custom object in the instance/one/one.app, the user is able to access the object. However, if they navigate off the object, they cannot find it in the side menu.

I am not sure what I am doing wrong, can any one help?
HI...
I tested create a job schedulable:

It work:
... for example:

String sch = '0 28 15 * * ?'
system.schedule('NomJobSchedulable' , sch, p);

String sch = '0 28 15 1,2,3,4-20,31 1,3,4,6 ?'
system.schedule('NomJobSchedulable' , sch, p);

It DONT work:
... for example:

String sch = '0 28 15 * * MON-FRI'
system.schedule('NomJobSchedulable' , sch, p);

All the different value ? I informe for day-of-week does not work.
Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.

Why?
Thank you

Hi All,

To get updates from salesforce Account, Contact and AccountContacRole objets into my local database. I have create pushTopic for Account and Contact object and recieving update messages using JAVA streaming client successfully. But when I was creating pushTopic for AccountContactRole object using following query in developer console. 

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'ACRoleTableStreaming';
pushTopic.Query = 'SELECT AccountId,ContactId,IsDeleted,IsPrimary,Role FROM AccountContactRole';
pushTopic.ApiVersion = 30.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;

I am getting following Error message.

12:59:29:065 EXCEPTION_THROWN [10]|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD, 'AccountContactRole' is not supported: [Query]

FYI I have also tries creating above pushTopic using https://workbench.developerforce.com. Still gote same Error.

Can anyone please tell me how can I ceate pushTopic for AccountContaactRole object or how can I get real time updates from this object into my local databse using salesforce Streaming Client or any other method ?

Hi Everyone,
Can any one please help us writting a test class for below batch apex class.That would be great help.

Global class BatchApex_UpdateOpp implements Database.Batchable<Sobject>{
    String TeamRole = 'Assign';
    Public String query = 'SELECT id,name,Opportunity.RecordType.name,(SELECT ID,Subject,LastModifiedDate FROM ActivityHistories order by LastModifiedDate DESC LIMIT 1 ),(SELECT id,LastModifiedDate,TeamMemberRole FROM OpportunityTeamMembers) From Opportunity ;                  
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }   
        //Execute Method 

        global void execute(Database.BatchableContext BC,List<Opportunity> scope){
        List<OpenActivity> alist=New List<OpenActivity>();
                
        List<OpportunityTeamMember> plist=New List<OpportunityTeamMember>();
        for(Opportunity ot : scope){
          
        for(ActivityHistory OPA : ot.getSObjects('ActivityHistories')){
            DateTime dT = OPA.LastModifiedDate;  
          //DateTime dT = ot.ActivityDate.LastModifiedDate;          
            Date myDate = date.newinstance(dT.year(),dT.month(),dT.day());            
            Integer numberDaysDue = (myDate.daysBetween(system.today()));
          
                if(OPA.Subject !=null){  
                   if(numberDaysDue > Integer.valueOf(System.Label.GE_OppTeamDays)){
                        for(OpportunityTeamMember  optm: ot.getSObjects('OpportunityTeamMembers')){
                            if(optm.TeamMemberRole=='Assign'){          
            plist.add(optm); 
        
            }
        }
    }
    }else{
            for(OpportunityTeamMember  optm: ot.getSObjects('OpportunityTeamMembers')){
                if(optm.TeamMemberRole=='Assign'){
                 
                    plist.add(optm); 
          
               }
            }
        }
 } 
}
        if(Plist.size()>0){
        delete plist;
       }
   }
      //Finish Method
    global void finish(Database.BatchableContext BC){       
    }   
 }    

Thanks in Advance
  • July 18, 2016
  • Like
  • 0
Hi, 

i have custom lookup reseller name to Reseller object in Quote, Reseller is ajunction object to account and Opportunty. In the Quote this lookup has a filter to select only resellars record belongs to opportunity.

This filter is working for editing the record but it is not working while creating the new record. below is the screenshot of filer
 Need Help plz asap.
Thanks in advance.

User-added image
Need to extend the standarad page date picker's Year using javascript.
Tried with VF page by injecting into the component console.
But due to cross-domain security issues,not able to do.
Any other ways...
 
Once the user saves the record, it must be saved as pdf and it should be mailed as an attachment to the record owner.
Hi all,
Is there a way to write a SOQL query to find out who is logged in or not in salesforce? I tried to use the combination of AuthSession with User sObjects but there was no success.
Thank you for your input, Sinan
Hi, I have requirement like this.
I have a pick list field with few values.i want to add some more picklist value to this field from excel sheet. Not like this object>field>edit...
Is there any chance to do this..

Thanks in advance.
<apex:page showHeader="false" sidebar="False" controller="InsertOEMIncentive" docType="html-5.0">
 
<apex:form >
    IncentiveType_Name<apex:inputText value="{!IncentiveType_Name}"/><br/>
   IncentiveType_Description<apex:inputText value="{!IncentiveType_Description}"/><br/>    
  IncentiveType_Image<apex:inputFile value="{!IncentiveType_Image}"/><br/>
  Incentive_EndDate<apex:input type="date" value="{!Incentive_Type_EndDate}"/><br/> 
   Incentive_StartDate<apex:input type="date" value="{!Incentive_Type_StartDate}"/><br/> 
    <apex:commandButton value="save" action="{!saveList}"/>
</apex:form>
</apex:page>
Hi all,

Iam trying to deploy a small changeset into my production org. I have a test class and normla class and these both work fine. However, there is a test class already in the org that seems to be failing. The error message it is giving me is:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You do not have permissions to create a Contact without an Account: [] 
Stack Trace: Class.TalentIntegrationTestSuite.testContactInsertTrigger: line 13, column 1

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You do not have permissions to create a Contact without an Account: [] 
Stack Trace: Class.TalentIntegrationTestSuite.testContactUpdateTrigger: line 22, column 1

This particular test class was created several years ago by a different person. I have tried disabling all validation rules in Accounts and Contacts however the error messgae is still the same. Any help would be much appreciated. Thanks.

Test Class:
@isTest
private class TalentIntegrationTestSuite {
   
    static testMethod void testContactInsertTrigger() {
        activateIntegration();
        
        Contact c = new Contact();
        
        c.FirstName = 'John';
        c.LastName = 'Smith';
        
        Test.startTest();
        insert c;
    }
    
    static testMethod void testContactUpdateTrigger() {
        activateIntegration();
        
        Contact c = new Contact();
        c.FirstName = 'John';
        c.LastName = 'Smith';        
        insert c;
        
        c = [Select Id, FirstName, LastName from Contact where Id=:c.Id];
        
        c.FirstName = 'Mary';
        Test.startTest();        
        update c;
    }

    static testMethod void testAccountInsertTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=true and sObjectType='Account' Limit 1].Id;
        a.FirstName = 'John';
        a.LastName = 'Smith';
        
        Test.startTest();
        insert a;
    }
    
    static testMethod void testAccountUpdateTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=true and sObjectType='Account' Limit 1].Id;
        a.FirstName = 'John';
        a.LastName = 'Smith';        
        insert a;
        
        a = [Select Id, FirstName, LastName from Account where Id=:a.Id];
        
        a.FirstName = 'Mary';
        Test.startTest();        
        update a;
    }
    
    static testMethod void testBusinessAccountUpdateTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=false and sObjectType='Account' Limit 1].Id;
    a.Name = 'Fabrikam';       
        
        insert a;
        
        Contact c = new Contact();
        c.FirstName = 'John';
        c.LastName = 'Smith';
        c.AccountId = a.Id;
        
        insert c;
        
                
        a = [Select Id, BillingPostalCode from Account where Id=:a.Id];
        
        a.BillingPostalCode = 'NE30 2PL';
        Test.startTest();        
        update a;        
    }
    
    static void activateIntegration()
    {
      CustomIntegrationSetting__c setting = CustomIntegrationSetting__c.getValues('CustomerTalentIntegration');      
    if (setting.isActive__c==false)
    {
      setting.isActive__c = true;
      update setting;  
    }  
    }
}

 
Hi Below code I am getting null values;
 
trigger CompareValues on Account__c (before insert) 
{
     
    for(Account appObj:Trigger.new)
    {
    
      If(appObj.City_Code__c !=  appObj.Sales_Name__r.City_Code__r.Code__c || appObj.Sales_Name__r.Salesman_Status__c=='Inactive')
        {
            appObj.addError('City Trigger Error');
  
        }
        
    
    }

below fields i am getting nullvalues..
appObj.Sales_Name__r.City_Code__r.Code__c
appObj.Sales_Name__r.Salesman_Status__c


Thansk in advance

 
Hi All,

I have a VF template with Apex Class on our Production. I update the Apex Class on our sandbox to add a filter criteria to limit the result. unfortunately when I try to deploy it, I receive an error that says "DerekUpdateSource.updateUpdateSource(), Details: System.LimitException: AVTRRT:Too many SOQL queries: 101 (AVTRRT)".

The tricky part is DerekUpdateSource test class is not what I am deploying its a different one and that "DerekUpdateSource" is already deployed on our Production.

What I did was, I run a test on DerekUpdateSource on our Production and it gave the error "Too many SOQL queries: 101 " but on our Sandbox when I run the test it passed.

The only changes that happened on our Org recently was Target Recruit (third party app) deployed a patch update on our production to resolve a bug. After that I can no longer deploy any class that uses queries record. 

Target Recruit on our Sandbox is not yet update to the lastest patch of Target Recruit.

Is the DerekUpdateSource test class that has a problem or the recent patch of target recruit?

If its DerekUpdateSource test class, I really do not have any other ideas how to shorten this.

DerekUpdateSource Test Class:

@IsTest
public class DerekUpdateSource {

    static testmethod void updateUpdateSource(){

        AVTRRT__Config_Settings__c mycs = AVTRRT__Config_Settings__c.getValues('Default');
    if(mycs == null) 
    {
        mycs = new AVTRRT__Config_Settings__c(Name= 'Default');
        mycs.Trigger_Disable_UpdateAccountName__c = true;
        insert mycs;
    }
        Contact c = new contact();
            c.LastName = 'Test';
            c.RecordtypeID = '012A0000000v0La';
            c.AVTRRT__Source__c = null;
        insert c;
        
        AVTRRT__ETCObject__c a = new AVTRRT__ETCObject__c();
            a.AVTRRT__Name__c = 'jobsDB';
            a.AVTRRT__Candidate__c = c.id;
        insert a;        
        AVTRRT__ETCObject__c b = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'jobsDB' and AVTRRT__Candidate__c = :c.Id limit 1];
        update b;
        
        Contact c1 = new contact();
            c1.LastName = 'Test1';
            c1.RecordtypeID = '012A0000000v0La';
            c1.AVTRRT__Source__c = null;
        insert c1;
        
        AVTRRT__ETCObject__c e = new AVTRRT__ETCObject__c();
            e.AVTRRT__Name__c = 'Clyde Marine Recruitment';
            e.AVTRRT__Candidate__c = c1.id;
        insert e;
        AVTRRT__ETCObject__c f = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Clyde Marine Recruitment' and AVTRRT__Candidate__c = :c1.Id limit 1];
        update f;
        
        Contact c2 = new contact();
            c2.LastName = 'Test2';
            c2.RecordtypeID = '012A0000000v0La';
            c2.AVTRRT__Source__c = null;
        insert c2;
        
        AVTRRT__ETCObject__c h = new AVTRRT__ETCObject__c();
            h.AVTRRT__Name__c = 'Corporate Event';
            h.AVTRRT__Candidate__c = c2.id;
        insert h;
        AVTRRT__ETCObject__c f1 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Corporate Event' and AVTRRT__Candidate__c = :c2.Id limit 1];
        update f1;
        
        Contact c3 = new contact();
            c3.LastName = 'Test3';
            c3.RecordtypeID = '012A0000000v0La';
            c3.AVTRRT__Source__c = null;
        insert c3;
        
        AVTRRT__ETCObject__c k = new AVTRRT__ETCObject__c();
            k.AVTRRT__Name__c = 'e Financial Careers';
            k.AVTRRT__Candidate__c = c3.id;
        insert k;
        AVTRRT__ETCObject__c f3 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'e Financial Careers' and AVTRRT__Candidate__c = :c3.Id limit 1];
        update f3; 
        
        Contact c4 = new contact();
            c4.LastName = 'Test4';
            c4.RecordtypeID = '012A0000000v0La';
            c4.AVTRRT__Source__c = null;
        insert c4;
        
        AVTRRT__ETCObject__c n = new AVTRRT__ETCObject__c();
            n.AVTRRT__Name__c = 'Email/Mailer Application';
            n.AVTRRT__Candidate__c = c4.id;
        insert n;
        AVTRRT__ETCObject__c f4 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Email/Mailer Application' and AVTRRT__Candidate__c = :c4.Id limit 1];
        update f4;
        
        Contact c5 = new contact();
            c5.LastName = 'Test5';
            c5.RecordtypeID = '012A0000000v0La';
            c5.AVTRRT__Source__c = null;
        insert c5;
        
        AVTRRT__ETCObject__c q = new AVTRRT__ETCObject__c();
            q.AVTRRT__Name__c = 'Indeed';
            q.AVTRRT__Candidate__c = c5.id;
        insert q;
        AVTRRT__ETCObject__c f5 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Indeed' and AVTRRT__Candidate__c = :c5.Id limit 1];
        update f5;      
        
        Contact c6 = new contact();
            c6.LastName = 'Test6';
            c6.RecordtypeID = '012A0000000v0La';
            c6.AVTRRT__Source__c = null;
        insert c6;
        
        AVTRRT__ETCObject__c t = new AVTRRT__ETCObject__c();
            t.AVTRRT__Name__c = 'Jobstreet';
            t.AVTRRT__Candidate__c = c6.id;
        insert t;
        AVTRRT__ETCObject__c f6 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Jobstreet' and AVTRRT__Candidate__c = :c6.Id limit 1];
        update f6;
        
        Contact c7 = new contact();
            c7.LastName = 'Test7';
            c7.RecordtypeID = '012A0000000v0La';
            c7.AVTRRT__Source__c = null;
        insert c7;
        
        AVTRRT__ETCObject__c w = new AVTRRT__ETCObject__c();
            w.AVTRRT__Name__c = 'LinkedIn - Resourcer';
            w.AVTRRT__Candidate__c = c7.id;
        insert w;
        AVTRRT__ETCObject__c f7 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'LinkedIn - Resourcer' and AVTRRT__Candidate__c = :c7.Id limit 1];
        update f7;
        
        Contact c8 = new contact();
            c8.LastName = 'Test8';
            c8.RecordtypeID = '012A0000000v0La';
            c8.AVTRRT__Source__c = null;
        insert c8;
        
        AVTRRT__ETCObject__c a1 = new AVTRRT__ETCObject__c();
            a1.AVTRRT__Name__c = 'Linkedin Advert';
            a1.AVTRRT__Candidate__c = c8.id;
        insert a1;
        AVTRRT__ETCObject__c f8 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Linkedin Advert' and AVTRRT__Candidate__c = :c8.Id limit 1];
        update f8;  
        
        Contact c9 = new contact();
            c9.LastName = 'Test8';
            c9.RecordtypeID = '012A0000000v0La';
            c9.AVTRRT__Source__c = null;
        insert c9;
        
        AVTRRT__ETCObject__c a9 = new AVTRRT__ETCObject__c();
            a9.AVTRRT__Name__c = 'Reed';
            a9.AVTRRT__Candidate__c = c9.id;
        insert a9;
        AVTRRT__ETCObject__c f9 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Reed' and AVTRRT__Candidate__c = :c9.Id limit 1];
        update f9;
        
        Contact c10 = new contact();
            c10.LastName = 'Test10';
            c10.RecordtypeID = '012A0000000v0La';
            c10.AVTRRT__Source__c = null;
        insert c10;
        
        AVTRRT__ETCObject__c a10 = new AVTRRT__ETCObject__c();
            a10.AVTRRT__Name__c = 'Red Website';
            a10.AVTRRT__Candidate__c = c10.id;
        insert a10;
        AVTRRT__ETCObject__c f10 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Red Website' and AVTRRT__Candidate__c = :c10.Id limit 1];
        update f10;
        
        Contact c11 = new contact();
            c11.LastName = 'Test11';
            c11.RecordtypeID = '012A0000000v0La';
            c11.AVTRRT__Source__c = null;
        insert c11;
        
        AVTRRT__ETCObject__c a11 = new AVTRRT__ETCObject__c();
            a11.AVTRRT__Name__c = 'Trade Winds';
            a11.AVTRRT__Candidate__c = c11.id;
        insert a11;
        AVTRRT__ETCObject__c f11 = [Select id from AVTRRT__ETCObject__c where AVTRRT__Name__c = 'Trade Winds' and AVTRRT__Candidate__c = :c11.Id limit 1];
        update f11;
}
}
I have a VF page that's enabled for Salesforce1. It uses the standard Quote Controller, and generates a PDF view of a Quote. I'd like to be able to see this page from within Salesforce1. Any idea how to make that happen?

Publisher Actions aren't supported for Quotes, so I can't create one.

I can't seem to get a custom "Preview Quote" button to appear in Salesforce1, although it does appear in the standard browser page layout.

I tried creating a formula field on the Quote object that uses the HYPERLINK function to launch the page, and while I can tell from the Debug Log that the page is being launched, it doesn't display in Salesforce1. (I've tried using "_self", "_top", and other options for the HYPERLINK function's third argument, but I see no difference in the results.)

Is there any way to get this PDF to display in SF1 while I'm sitting on the Quote page?
 
Hi,
I have an requirement where I need to create pageBlock table which has the below fetatures
1: Table should display more than 5000 records
2: client side pagination
3: Client side sorting
4: Search for text from table records

I have implemented the following
1: using jquery I have achieved  2nd, 3rd and 4th requirements but here we cannot have more than 1000 records in table
(reference : http://force201.wordpress.com/2013/08/17/client-side-sorting-and-pagination-of-an-apexpageblocktable/ )
2: Using offSet we can fetch upto 2000 record only and client side sorting , searching options are not available
3: Usign standardSetController we can get upto 10000 reocrds with pagination, but we cannot do clientside sorting, searching

Is there any way to achieve all the 4 options metnioned above? or atleast first 3. Please help




 
Hello ,

I have one sandbox in which I have created two triggers and one class with its test class and trigger having 81% coverage and class having 100% coverage but when I tried to deploy the code to production it is giving me error that code coverage is 64%. How is it possible ? There is no data in the production and no classes.

Please let me know if anyone can help me for this ASAP. Please email me @mike@cloudtechy.com or reply to this post.
Any help would be appreciated.

Thanks,
Minkesh
Hi Experts,

My test class is failing and I can't figure out why. Any assistance is greatly appreciated.

This is the error message:

System.QueryException: List has no rows for assignment to SObject

Stack Trace Class.GenerateJobOfferController.<init>: line 6, column 1
                   Class.GenerateJobOfferController_Tests.myUnitTest: line 15, column 1

This is the test class as a whole:
 
@isTest
private class GenerateJobOfferController_Tests {

    static Account objAccount;   
    static Contact objContact;
    static Job_Order__c objJobOrder;
    static Candidate__c objCandidate;
    static Candidate_Applications__c objApplication;
    
   
    static testMethod void myUnitTest() {
        // TO DO: implement unit test
         LoadData();
        ApexPages.StandardController stdController = new ApexPages.StandardController(objApplication);
        GenerateJobOfferController objGenerateJobOfferController = new GenerateJobOfferController(stdController);
       
   }
   
   static void LoadData(){
        createAccount();
        createContact();
        createJobOrder();
        createCandidate();
        createApplication();
        
   }
   
   static void createAccount(){
        objAccount = new Account();
        objAccount.Name = 'Test Account';
        
        insert objAccount;
        
        //assert..........
        Account TempAccount = new Account();
        TempAccount = [select id from Account where id =:objAccount.id];
        system.assertEquals(TempAccount.id == objAccount.id, true);
    }
    static void createContact(){
        objContact = new Contact();
        objContact.LastName = 'Test Contact';
        objContact.email = 'benX585@gmail.com';
        objContact.AccountId = objAccount.id;
        
        insert objContact;
        
        //assert..........
        Contact TempContact = new Contact();
        TempContact = [select id from Contact where id =:objContact.id];
        system.assertEquals(TempContact.id == objContact.id, true);
    }
    
    static void createJobOrder(){
        objJobOrder = new Job_Order__c();
        objJobOrder.Job_Title__c = 'Test Title';
        objJobOrder.Start_Date__c = date.today();
        objJobOrder.End_Date__c = date.today();
        objJobOrder.Status__c = 'Hiring';
        objJobOrder.Contact_Client__c = objContact.id;
        objJobOrder.Salary_Range__c = '123-123';
        objJobOrder.Experience_level_desired__c = 'Student';
        
        insert objJobOrder;
        
        //assert..........
        Job_Order__c TempJobOrder = new Job_Order__c();
        TempJobOrder = [select id from Job_Order__c where id =:objJobOrder.id];
        system.assertEquals(TempJobOrder.id == objJobOrder.id, true);
    }
    static void createCandidate(){
        objCandidate = new Candidate__c();
        objCandidate.Last_Name__c = 'Test Candidate';
                
        insert objCandidate;
        
        //assert..........
        Candidate__c TempCandidate = new Candidate__c();
        TempCandidate = [select id from Candidate__c where id =:objCandidate.id];
        system.assertEquals(TempCandidate.id == objCandidate.id, true);
    }
        
   static void createApplication(){
        objApplication = new Candidate_Applications__c();
        objApplication.Candidate_Status__c = 'New';
        objApplication.Job_Order__c = objJobOrder.id;
        objApplication.Candidate__c = objCandidate.id;
        
        insert objApplication;
        
        //assert..........
        Candidate_Applications__c TempApplication = new Candidate_Applications__c();
        TempApplication = [select id from Candidate_Applications__c where id =:objApplication.id];
        system.assertEquals(TempApplication.id == objApplication.id, true);
    }
    
  }

Thank you in advance.
I'm trying to create a simple trigger on Opportunity that updates a custom field on all related OpportunityLineItems when the Opportunity stage is updated to Closed/Won.  I have this code, but I'm getting an error saying oli variable does not exist.
trigger onOpportunityWon on Opportunity (after update) {
Set<Id> relevantIds = new Set<Id>();
    // select relevant opportunities
    for(Opportunity o : trigger.new)
    {
        if(o.StageName == 'Closed Won' || trigger.oldMap.get(o.Id).StageName == 'Closed Won')
        {
            relevantIds.add(o.Id);
        }
    }

    // Line Items
    for(OpportunityLineItem oli : [SELECT ID, WonWhen__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId IN :relevantIds])
    {
        oli.WonWhen__c = system.today();
    }

if (oli.size()>0)
    update oli.values();
}
What am I doing wrong?  Thank you!
System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.: []
Error is in expression '{!sendEmail}' in component <apex:commandButton> in page selectcontactforcustomerfeedback: Class.sendEmail.sendEmail: line 28, column 1

here is the code

public with sharing  class sendEmail
{
    public Customer_Feedback__c cfc{get;set;}
    Customer_Feedback__c cusfb = new Customer_Feedback__c();
  
   
    public sendEmail(ApexPages.StandardController controller)
     {
        cfc = new Customer_Feedback__c();
     }
   
    public PageReference sendEmail()
    {
       cusfb.Contact__c = cfc.Contact__c;
       insert cusfb;
        system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+cusfb);
   
 
    Contact c = [select Name,Email from Contact where Id=: cusfb.Contact__c];
   
    system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+c);
   
            Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
            message.setSubject('A new External Case Comment has been posted');
            message.setPlainTextBody(cusfb.Id);
            message.setToAddresses(new String[] { c.Email });

            Messaging.sendEmail(new Messaging.Email[] {message});
 
 
   ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Registered Sucessfully, Feedback Security Code is sent to the Contact Email.');
   ApexPages.addMessage(myMsg);
    return null;
   }
}
 
I have installed Recurring donation npsp package from salesforce foundation and enabled Multi Currency
getting this error - Opportunity.CurrencyIsoCode does not belong to SObject type AggregateResult

Has anyone faced this issue before