• Krishna.Avva
  • NEWBIE
  • 394 Points
  • Member since 2016
  • Salesforce Technical Lead
  • Wolters Kluwer

  • Chatter
    Feed
  • 11
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 97
    Replies
Hi Everyone,

I am new to code and the new Salesforce Administrator foe my company. How do I revise Apex code to include additional lookup for allowed contact based on record type? I would also consider deleting it altogether.

Here is the full error message users are receiving.
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger DealCorrespondenceNoteTrigger caused an unexpected exception, contact your administrator: DealCorrespondenceNoteTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a062K00001xpI1TQAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Only Contacts from the Account in the Deal Correspondence record are allowed.: [Contact__c]: Class.DealCorrespondenceNoteManager.DealCorrespondenceUpdateNote: line 13, column 1


Thank you for any help you are able to provide. Please advise if additional details are necessary.
Hi Team,

How to I create dropdown of tabs in a salesforce app?

Thanks,
S

I'm investigating how to integrate an online store with salesforce.
I'm wondering, best practices, where the data should reside in salesforce.
Once an order is placed in the online store, how is it represented. Would it create a closed opportunity with opportunity products as the line items?
Perhaps a separate Received payment object (custom?) in case of multiple/partial payments (not sure this is a requirement)
I noticed there is an standard order object that can be activated. Is this the area I should be investigating.

I'd love some insight into the overall object model, preferably using as much standard salesforce as is available.
Further down the road donations, and other form based 'sales' would also need to be tracked, some including $0 items if that matters.

Basically if you had a green field how would you proceed.
Hello,

I have a cutom button on click execute javascript.
How can i add this button to lightning pag layout

thanks for suggestion
Hello,

How is it possible to createa certificate and add a certificate during API call
Can i add this line
​​​​​​​  req.setClientCertificateName('certiname');


thank you for sugggestion
Hello all,
I'm trying to create a custom apex controller for a visualforce page, but no matter what i've tried, I cannot create an apex class in the developer console.  I am using a developer account, and am working in a developer org, and I still can't create apex classes. Is there something I am missing? Is there any alternative I can try to develop an apex class? 

Thank you in advance,
Connor
What is the call limit and data limit for an external rest API?  I am planning to write an APEX batch job what will be scheduled to run hourly.  This batch job will call an external Rest API up to 300 times and retrieve 4500 records which will be inserted as Big Objects.  Is this possible with Salesforce?
Hi!

I have two Android applications using the Salesforce SDK, the user will be redirect from the first app to the second one. How can I handle the user session to avoid make him login twice. It is possible to do this?

Thank you
Hi, 

 I am writing test class for below class but @future method is not getting covered. Please suggest me how to cover. 
public class CpqQuoteTriggerUtil {

    public static void createQuoteShareFromOpportunity(List<SBQQ__Quote__c> newLst) {
        system.debug('Calling CpqQuoteTriggerUtil.createQuoteShareFromOpportunity' + newLst);
        Map<ID,ID> optyQuoteMap = new Map<ID,ID>();
        List<SBQQ__Quote__share> insertShares = new List<SBQQ__Quote__share>();
        List<SBQQ__Quote__share> currentUserShare = new List<SBQQ__Quote__share>();
        for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                optyQuoteMap.put(quote.SBQQ__Opportunity2__c, quote.id);
            }
            currentUserShare.add(new SBQQ__Quote__share(UserOrGroupId = userinfo.getUserId(),
                                                ParentId = quote.id,
                                                AccessLevel = 'Edit'));
        }
        //Map<Id, List<SBQQ__Quote__share>> oppToQuoteShareLst = new Map<Id, List<SBQQ__Quote__share>>();
        Boolean notOppOwnerFlg = false;
        Set<Id> userids = new Set<Id>();
        ID OptyOwnerId;
        Id qid;
        //for Opportunity share
        for(OpportunityShare r : [SELECT Id, OpportunityId,Opportunity.ownerid, UserOrGroupId, OpportunityAccessLevel, 
                                            RowCause 
                                            FROM OpportunityShare 
                                            where opportunityid = :optyQuoteMap.keyset() and RowCause in('Rule', 'Team')]) {
            if(userids.isEmpty()) {
                userids.add(r.Opportunity.ownerid);
                OptyOwnerId = r.Opportunity.ownerid;
                qid = optyQuoteMap.get(r.OpportunityId);
            }
            if(!userids.contains(r.UserOrGroupId) ) {
                userids.add(r.UserOrGroupId);
                //insertShares = new List<SBQQ__Quote__share>();
                insertShares.add(new SBQQ__Quote__share(UserOrGroupId = r.UserOrGroupId,
                                                    ParentId = optyQuoteMap.get(r.OpportunityId),
                                                    AccessLevel = r.OpportunityAccessLevel == 'All' ? 'Edit': r.OpportunityAccessLevel));
                if(r.Opportunity.ownerid != userinfo.getUserId()) {
                    notOppOwnerFlg = true;
                }
                system.debug(insertShares);
            }
        }

        //for Default Opportunity Teams // sudhir Test here for 
        for(UserTeamMember r : [SELECT Id,OpportunityAccessLevel,OwnerId,TeamMemberRole,UserId 
                                                FROM UserTeamMember where ownerid   = :OptyOwnerId] ) {
                insertShares.add(new SBQQ__Quote__share(UserOrGroupId = r.UserId,
                                                    ParentId = qid,
                                                    AccessLevel = r.OpportunityAccessLevel));
        }
        system.debug('share from opty :: ' + insertShares);
        if(notOppOwnerFlg) {
            system.debug('for user share creator :: ' + currentUserShare);
            insertShares.addAll(currentUserShare);
        }

        Database.SaveResult[] srList = database.insert(insertShares, false);
        for (Database.SaveResult sr : srList) {
            if (sr.isSuccess()) {
                // Operation was successful, so get the ID of the record that was processed
                System.debug('Successfully inserted account. Account ID: ' + sr.getId());
            }
            else {
                // Operation failed, so get all errors                
                for(Database.Error err : sr.getErrors()) {
                    System.debug('The following error has occurred.');                    
                    System.debug(err.getStatusCode() + ': ' + err.getMessage());
                    System.debug('Account fields that affected this error: ' + err.getFields());
                }
            }
        }

    }
    public static void prepopulateApproverLevelFromOwner(List<SBQQ__Quote__c> newLst) {
        Set<id> opps = new set<id>();
            for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                opps.add(quote.SBQQ__Opportunity2__c);
            }
        }
        
        Map<id, Opportunity> optyMap = new Map<id, Opportunity>([select id, owner.SPR_Approver_Director_Level__c,owner.SPR_Approver_EVP__c,
                                                owner.SPR_Approver_GVP__c,owner.SPR_Approver_RVP__c,owner.SPR_Approver_GD_Group_Director__c,
                                                 owner.SPR_Approver_RD_Regional_Director__c
                                                 from opportunity where id = :opps]);
        //Approval
        for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                Opportunity opp = optyMap.get(quote.SBQQ__Opportunity2__c);
                    quote.ownerid = opp.ownerid;
                quote.CPQ_Approver_Director__c = opp.owner.SPR_Approver_Director_Level__c;
                quote.CPQ_Approver_RVP__c = opp.owner.SPR_Approver_RVP__c;
                quote.CPQ_Approver_GVP__c = opp.owner.SPR_Approver_GVP__c;
                quote.CPQ_Approver_EVP__c = opp.owner.SPR_Approver_EVP__c;
                quote.CPQ_Approver_RD_Regional_Director__c = opp.owner.SPR_Approver_RD_Regional_Director__c;
                quote.CPQ_Approver_GD_Group_Director__c = opp.Owner.SPR_Approver_GD_Group_Director__c;
            }
        }
    }

    public static void processQuoteOnBeforeUpdate(Map<Id, SBQQ__Quote__c> newMap, Map<Id, SBQQ__Quote__c> oldMap){
        for(SBQQ__Quote__c q : newMap.values()) {
            SBQQ__Quote__c oldQ = oldMap.get(q.Id);
            system.debug(q.CPQ_Quote_Remaining_Claim_Status__c  + '_'+ q.CPQ_Quote_Product_Count__c + '_'+oldQ.CPQ_Closed__c );
            if(q.CPQ_Quote_Remaining_Claim_Status__c  <= 0 && q.CPQ_Quote_Product_Count__c > 0 && oldQ.CPQ_Closed__c == false) {
                q.CPQ_Closed__c = true;
            } else {
                q.CPQ_Closed__c = false;
            }
            system.debug(q.CPQ_Closed__c +'_');
        }
    }
    
    public static void processQuoteOnAfterUpdate(Map<Id, SBQQ__Quote__c> newMap, Map<Id, SBQQ__Quote__c> oldMap){
        Set<ID> Idset = new Set<ID>();
        for(SBQQ__Quote__c q : newMap.values()) {
            SBQQ__Quote__c oldQ = oldMap.get(q.Id);
            if(q.CPQ_Quote_Remaining_Claim_Status__c  <= 0 && q.CPQ_Quote_Product_Count__c > 0 && q.CPQ_Closed__c == true && oldQ.CPQ_Closed__c == false) {
                Idset.add(q.Id);
            }
        }

        if(!IdSet.isEmpty()) {
            updateOpportuntiy(IdSet);
        }
    }

    @future
    public static void updateOpportuntiy(Set<Id> Idset){
        Set<Id> oppIdSet = new Set<Id>();
        List<Opportunity> oppLst = new List<Opportunity>();
        system.debug(Idset);
        for(SBQQ__Quote__c q : [select id, name, CPQ_Distributor__r.name, SBQQ__Opportunity2__c, SBQQ__Opportunity2__r.stageName                                               
                                                                                      from SBQQ__Quote__c 
                                                                                      where id in :IdSet and 
                                                                                      (CPQ_Distributor__r.name like 'US -%' Or CPQ_Distributor__r.name like 'CAN -%' OR CPQ_Distributor__r.name like 'LAT -%' )] ){
            if(!oppIdSet.contains(q.SBQQ__Opportunity2__c)) {
                oppIdSet.add(q.SBQQ__Opportunity2__c);
                Opportunity opp = new opportunity(id = q.SBQQ__Opportunity2__c);
                if(q.CPQ_Distributor__C != null) { 
                        If((q.CPQ_Distributor__r.name.Startswith('US -') || q.CPQ_Distributor__r.name.Startswith('CAN -'))
                            &&  (q.SBQQ__Opportunity2__r.stageName != 'P.O. Issued,Fortinet can Ship & Invoice' && q.SBQQ__Opportunity2__r.stageName != 'Closed Won - All Products on Leaderboard')) {
                        opp.stageName = 'P.O. Issued,Fortinet can Ship & Invoice';
                        oppLst.add(opp);
                    }  else If (q.CPQ_Distributor__r.name.Startswith('LAT -') 
                            &&  q.SBQQ__Opportunity2__r.stageName != 'Closed Won - All Products on Leaderboard') {
                        opp.stageName = 'Closed Won - All Products on Leaderboard';
                        oppLst.add(opp);
                    }
                }
            }
            system.debug(oppLst);
            if(!oppLst.isEmpty()) {
                update oppLst;
            }
        }
    }
        /*
    public static void lockAfterApproval(List<SBQQ__Quote__c> newQ, List<SBQQ__Quote__c> oldQ) {
    
    SBQQ__Quote__c blankQuote = new SBQQ__Quote__c();
    Schema.SObjectType objType = blankQuote.getSObjectType();
    Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.SBQQ__Quote__c.fields.getMap();
        
            
        
    } 
    
        private static void updateSPRAndCategoryMetrics(List<SBQQ__QuoteLine__c> sprProductList, String sprId) {
    
}*/
}
User-added image

Above code is not covered. 

Below is the test class writter it is having only 67% code coverage
@isTest(seealldata=true)
public class CpqQuoteTriggerUtilTest
{  
    public static testMethod void method1(){
        
        Profile profileObj =[select id from Profile where name='System Administrator' limit 1];
        User u = new User(
            FirstName = 'Sudhir',
            LastName = 'Testing Usre',
            Alias = 'tstN',
            Email = 'test11@abc.com',
            Username = 'partne1r11@abc.com',
            CommunityNickname = 'testi11',
            emailencodingkey = 'UTF-8',
            languagelocalekey = 'en_US',
            localesidkey = 'en_US',
            timezonesidkey = 'America/Los_Angeles',
            profileId = profileObj.Id,
            spr_region__c = 'LATAM',
            NFR_User__c  = false,
            SPR_to_Forticare_Linking__c = true
        );
        insert u;
        
        Distributor__c Dist = [select id from Distributor__c where CPQ_DistributorStatus__c  = true limit 1];
        
        Account Pact = [select id from account where recordtype.name = '.Partner' and Is_In_RV_Portal__c = true and Partner_Status__c = 'Activated' limit 1];
        
        Contact Pcnt = [select id from contact where accountid = :Pact.id  limit 1];    
        
        Account Act = new Account( Name = 'Test Sudhir Ac',Website='www.sudhir.com',Industry='Legal',BillingStreet='894', BillingCity='sunnyvalley', BillingState='CA', 
                                  BillingPostalCode='997',BillingCountry='United States',Customer_Status__c='Current Customer');  
        
        insert Act; 
        
        Contact C = [select id from contact limit 1];
        
        Opportunity opp = new Opportunity(
            AccountId=Act.id,
            StageName='Omit from Forecast',
            Amount = 0,
            Name = 'Test Sudhir',
            CloseDate = Date.today(),
            Market_Segmentation__c = 'Education',
            End_User_Industry__c = 'Education',
            End_Customer_Country__c = 'United States',
            Deal_Type__c='Refresh',
            Primary_Opportunity_Contact__c =  c.id,
            Distributor__c = Dist.id
        );
        
        insert opp;
        
        OpportunityTeamMember oppmem = new OpportunityTeamMember(
            Opportunityid = opp.id,
            OpportunityAccessLevel = 'Read' ,
            TeamMemberRole = 'CAM',
            Userid = u.id ); 
        
        
        insert oppmem;
        
        
        
        SBQQ__Quote__c SQ = new SBQQ__Quote__c(SBQQ__Opportunity2__c = opp.id,
                                               CPQ_Distributor__c = Dist.id,
                                               CPQ_Partner_Account__c = Pact.id,
                                               CPQ_Partner_Contact__c = Pcnt.id
                                              );
        
        
        insert SQ;
        
        
        
        SBQQ__Quote__share SQS = new SBQQ__Quote__share(UserOrGroupId = u.id,
                                                        ParentId = SQ.id,
                                                        AccessLevel  = oppmem.OpportunityAccessLevel
                                                       );
        
        insert SQS;
        
        
        
        opp.stageName = 'P.O. Issued,Fortinet can Ship & Invoice';
        opp.Partner_Initiated__c = 'No';
        
        update opp;
        
    }
    
 
    
}

 
I am trying to reuse a piece of code I've used many times before. The code schedules a batch class from another Apex class. When I try to edit it in Developer Console or an IDE, I get the following error: "Method does not exist or incorrect signature: void scheduleBatch(testBatch, String, Decimal) from the type System". testBatch IS a batchable class. Why is the compiler pulling the NAME of the batchable class into the method?

Here is my code:
Apex class:
public class testClass {
    public static void testSchedule() {
        testBatch batchable = new testBatch();
        String jobName = 'testBatch';
        Decimal minutesFromNow = 0.0;

        try {
            String cronId = System.scheduleBatch(batchable, jobName, minutesFromNow);
            CronTrigger ct = [SELECT Id, NextFireTime FROM CronTrigger WHERE Id = :cronID];
            System.debug(jobName + ' jobId: ' + cronID);
            System.debug(jobName + ' next fire time: ' + ct.NextFireTime);
        } catch (Exception e) {
            System.debug('Error scheduling batch: '+e.getMessage());
        }
    }
}

Here is the batch class:
global class testBatch implements Database.Batchable<sObject> {
    private static String query;

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<sObject> scope){
    }

    global void finish(Database.BatchableContext BC){
    }
}
Thanks in advance!
Hello,

I wanted to know, how can i create a hyperlink anddisplay it in a section of the Opportunity.

The use casecab be achived by formulawith hyperlink, bu i want the same usecase with button

Thank you for suggestion
Hi,

I am trying to bring in Tableau dashboards into Salesforce. All the connections are working fine. I get OK on all the status checkes between Salesforce, Sparkle and Tableau servers. However, when i launch the VF Page which has the canvas app(which should display the Dashboard ideally), I get the following error:

SPARKLER ERROR: Unable to process request. Check parameters/environment variables are set correctly.

Please let me know if someone has faced this issue before and how did they solve it. Thanks for your time.
How can i calculate retirement date (Retirement_Date__c) by subtracting birthdate (birthdate) from retirement age (Retirement_Age__c).  I would like to breakout the birth date by years and months to make the retirement date more accurate.

I tried to write the formula and was getting an error
Hi Everyone,

I am new to code and the new Salesforce Administrator foe my company. How do I revise Apex code to include additional lookup for allowed contact based on record type? I would also consider deleting it altogether.

Here is the full error message users are receiving.
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger DealCorrespondenceNoteTrigger caused an unexpected exception, contact your administrator: DealCorrespondenceNoteTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a062K00001xpI1TQAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Only Contacts from the Account in the Deal Correspondence record are allowed.: [Contact__c]: Class.DealCorrespondenceNoteManager.DealCorrespondenceUpdateNote: line 13, column 1


Thank you for any help you are able to provide. Please advise if additional details are necessary.
hi,
my requirement is

 After the batch is over, Teacher will mark the batch as complete. Then the course will be moved from Requested Courses to Completed Coursed for all the students of the batch. Before marking a batch as complete, the teacher can remove any student from the batch. This will not be possible after the batch is completed.
Relationship:
User-added imageim trying to access the students whose batch is completed(batch has a checkbox mark as complete or not)
trigger Batch on Batch__c (before insert,after update) {
    List<String> b= new List<String>();  
     for(Batch__c p: Trigger.new){
         b.add(p.Name);
     }
    List<Student__c> c=new List<Student__c>([select Student__r.Name from Student_Batch_Junction__c where Batch__r.Name in :b]);
    
    
}

I tried to access student in this way..it is showing error
We have created a Package in a Developer Org which we used to deploy with our customers. Suddenly we receive a notification and error when we want to add items into the Package or deploy the package. The notification is: Bad Reference found.  See belowUser-added imagePlease press Recompile All or edit and resave the following items. When trying to recompile All we receive an error: An internal server error has occured.  See below

User-added image
We have several developer Orgs and this issue appears in all Orgs.

Does someone know what we can do so we can create/edit and deploy packages again?
Hi Community,

I need help to get state list by country using apex. 
Thanks
Hi,
So I'm creating a Salesforce integration through the REST API to connect out org with an external third party software. Essentially the user will change a 'Status' on a custom object record in Salesforce, this would then trigger an API call to get results information from the third party and populate that data in a field on the corresponding record in Salesforce/

How would I go about starting this? What are the different components I need to develop the integration?

Any help is much appreciated!!
Many Thanks,
Natasha
Hi,

When lead created from our web form, visitors put their full name into the FIRST NAME field.

I need a way to find how many words in the field and then split it and update it back to the first and last name field in the lead.

Here is an example when the lead created

First Name: Johnny Clark
Last Name: [not provided]

I want to split it out correctly using processes builder.

First Name: Johnny
Last Name: Clark

Does anyone have any idea? please let me know.

Thanks!
Below is the example scenario from an interview. Could anyone help here
I have a scenario where I am displaying list of fields from an Account object using standard list controller. Now I have to display all fields in the account object using a vf page. If any new fields are created in the object or any existing fields are deleted from object the vf page should dynamically get fields and their respective values. The controller should not use any fieldsets or custom settings. The code should be written in a way where there should be no need to modify either code or cofigurations when there are changes happening in the object.
Can some one please explain how to acheive this.
  • April 21, 2019
  • Like
  • 0
Hi Team,

Could someone provide a verified Flow complete tutorial and videos?

Thanks,
S
Hi Team,

How to I create dropdown of tabs in a salesforce app?

Thanks,
S
We have specific fields that need to be locked down, but we need to determine who has edit access.  We have quite a lot  of Permission sets and Profiles.  Is there a way to look for a field and see the access for all the profiles and permission sets?  
I am researching ways to Integrate our External System (Database) with Salesforce. 
Salesforce Connect/ Lightning Connect would do exactly what we want but its far too expensive. 
I don't want to store data into salesforce. I want to only send requests to External System, and display the response in Salesforce. 

Can someone please point me to resources or  guide how I would create go about doing webservice callouts from salesforce to external system? 
Thanks you !!
  • April 15, 2019
  • Like
  • 0
Hello,

I have a trigger like below, how can i make it execute only for one record type.Name
trigger XTrigger on Order (after update) {
    if (Trigger.isAfter && Trigger.IsUpdate) {
        Class_Name.functionName(Trigger.new);
    }

Thank you for suggestion
Is possible to disable cache during Lightning Component development?  I'm running into an issue where I've fixed a bug, but keep getting the error when I test.  And I know it's a caching issue because the error is on line number 29, but my component only has 24 lines of code.  I've tried disabling cache in the org and refreshing the web browser without cache.  Are there any other options available to ensure every time I load a Lightning component I'm getting the latest code?
Hi all,

I created a flow that call an apex class to run an asyncronous method to collect several data.
When I run flow as system administrator, everything is working as expected; method is executed in the future and flow is completed.

This flow should be used by Sales Rep, but future method is not enqueued because of following error.

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

I tried to understand which kind of configuration was missing; but the only way to execute method is to enable 'Modify All Data'. According to me, this is not a great solution. Do you have any idea how I can achieve my goal without enable 'Modify All Data' option.
hello , my test class for this controller is giving 88% coverage, but it is not being deployed , can any one help me in this


public class addJobCntrl {

Public string leadID{get;set;}
Public Lead leadIns{get;set;}
Public Job__c jobIns{get;set;}
Public Job__c testjobIns{get;set;}


public addJobCntrl (){

leadID = apexpages.currentpage().getparameters().get('id');
leadIns= [select id, Company, State__c, Street__c , Zip__c , City__c , Type_of_Service_Proposal__c , Name  , Sales_Person__c, Insurance_Amount__c , Email, Credit_Application_received__c, Credit_Limit_Amount__c,  Phone from Lead where ID =: leadID ];
jobIns = new Job__c(Lead__c = leadID );


}


Public PageReference creatContract(){


jobIns.Name = leadIns.Company;
jobIns.Street__c = leadIns.Street__c ;
jobIns.State__c = leadIns.State__c ;
jobIns.Zipcode__c = leadIns.Zip__c ;
jobIns.City__c = leadIns.City__c ;
jobIns.Service_Type__c = leadIns.Type_of_Service_Proposal__c ;
jobIns.Billing_Contact__c = leadIns.Name  ;
jobIns.Billing_Email__c = leadIns.Email;
jobIns.Billing_Phone_Number__c =  leadIns.Phone;
jobIns.Credit_Application_received__c = leadIns.Credit_Application_received__c;
jobIns.Credit_Amount_Limit__c = leadIns.Credit_Limit_Amount__c;
jobIns.Insurance_Amount__c = leadIns.Insurance_Amount__c;
jobIns.Sales_Rep__c = leadIns.Sales_Person__c;

upsert jobIns;


PageReference p = new PageReference('/' + this.jobIns.Id );
return p;
}
}


this is Test class 

@isTest 
public class addJobCntrlTest{

static testMethod void testMethod1() {
       Account custIns = new Account();
       custIns.Name = 'test';
       custIns.QB_Company__c = 'qfs';
       custIns.QB_Account__c = 'test'; 
       custIns.Service_Type__c  = 'Mid-Construction';
       insert custIns;
       
       Job__c jobIns = new Job__c();
       jobIns.Name = 'test';
       jobIns.Sales_Rep__c = 'Aharon Kaplan';
       jobIns.Customer__c = custIns.ID;
       jobIns.Billing_Contact__c = 'test';  
       jobIns.Billing_Email__c= 'test@test.com'; 
       jobIns.Billing_Phone_Number__c= '123'; 
       jobIns.QB_Job_Name__c = 'test';   
       jobIns.QB_Company__c = 'QFS';
       
       insert jobIns;
       
       
        
       Lead testRecord= new Lead();
       testRecord.LastName = 'test name ';
       testRecord.Company = 'test company';
       testRecord.Status = 'new';
       testRecord.Credit_Limit_Amount__c = 12344;
       insert testRecord;
     

        Test.setCurrentPage(Page.addJob);
        System.currentPageReference().getParameters().put('id', testRecord.Id);

        addJobCntrl addjobCntrlTestIns = new addJobCntrl();
        
        addjobCntrlTestIns.creatContract();
    }
 }


and this is error i keep getting from test run 

upsert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Customer__c]: 

 
@Future ( callout =true  ) does this method count towards API call ?   
APPLY HERE: https://www.amazon.jobs/en/jobs/700334/salesforce-com-developer

We are looking for a talented and experienced Salesforce.com developer to facilitate sales automation and enablement initiatives for our rapidly growing sales, account management, services and marketing teams. This individual will be a member of a team that is responsible for maintaining the system/data and expand on Salesforce’s integration capabilities to provide scalable and maintainable solutions on the Force.com platform. This includes development, configuration, administration of Salesforce.com and integration with other Amazon databases/systems.

BASIC QUALIFICATIONS
· Bachelor’s degree in Computer Science, Software Engineering, MIS or related field.
· Certified Salesforce Platform Developer I or equivalent experience
· 3+ years development experience with Salesforce.com (Visualforce, Apex, SOQL and SOSL)
· Proficiency in writing Visualforce, Apex classes/controllers, triggers, Salesforce.com architecture and API
· Proficiency in related tools (Data Loader, Workbench, Force.com IDE, Developer Console), cloud or on premise middleware and other enterprise integrating technologies (Informatica)
· Knowledge of integrations, third-party integration tools and ETL with Salesforce

PREFERRED QUALIFICATIONS
· Certified Salesforce Platform Developer II or equivalent experience
· 3+ years’ experience in enterprise, application and information architecture methodologies and design
· Proficiency in HTML, XML JavaScript, SQL, Java or C++, SOAP-based web services, REST services
· In depth understanding of the capabilities and constraints of the Salesforce CRM application coupled with good understanding of the business processes (Sales, Operations, Customer Success, Marketing, Partner Management, etc.)
· Demonstrative success with at least one large Salesforce.com integration project and/or two or more end-to-end Salesforce.com implementations
· Knowledge of software development patterns & best practices for the full software development life cycle, including coding standards, code reviews, source control management, build processes, testing, and operations
· Handle multiple competing priorities in a fast-paced, deadline-driven environment