• vivek singh08481200707119766
  • NEWBIE
  • 95 Points
  • Member since 2014
  • saasforce consulting pvt limited


  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 2
    Likes Given
  • 20
    Questions
  • 22
    Replies
Error: Compile Error: Entity is not org-accessible at line 2 column 9



how i solve it
my test class is --------------------------------------------------------------------

@isTest
private class invoiceTrackerTestSuite {
static testMethod void runPositiveTestCases() {
      Account objAccount = new Account();
      objAccount.Name = 'Vivek';
      objAccount.Type = 'Supplier';
      objAccount.Phone = '1234';
      objAccount.CurrencyIsoCode = 'AUD';
      insert objAccount;
      Contact objcontact = new contact();
      objcontact.LastName = 'Singh';
      objcontact.CurrencyIsoCode = 'AUD';
      objcontact.Account = objAccount ;
      insert objContact;
     
      opportunity objopportunity= new opportunity ();
      objopportunity.Name = 'Hindi2014';
      objopportunity.CloseDate = system.Today();
      objopportunity.Account = 'objAccount';
      objopportunity.Vendor__c = 'objaccount.id';
      objopportunity.StageName = 'Closed Won - Signed';
      objopportunity.Billing_Terms__c = 'On Completion';              
      objopportunity.Type = 'New Business';
      insert Objopportunity;
    
     
     
   opportunitylineitem objopportunitylineitem = new opportunitylineitem();
    insert objopportunitylineitem ;
   
    Invoiceobjinvoice=new Invoice();
    objInvoices.Account_Invoice__c='Neo@Ogilvy';
    objInvoices.Amount__c='2400';
    objInvoices.Invoice_link__c='google';
    objInvoices.Invoice_Status__c='Paid';
    objInvoices.Opportunity_invoices__c='DD Test 2015';
    objInvoices.Site_or_Partner__c='RAP';
    insert objinvoice;
   
  }
}

Trigger
_______________________
trigger makeInvoice on Opportunity (after insert, after update) {
   
    for(Opportunity op :trigger.new){
        if(op.StageName == 'Closed Won - Signed'){
           List<OpportunityLineItem> opli = new List<OpportunityLineItem>();
            opli = [select id,Gross__c, Product2id, OpportunityId from OpportunityLineItem where OpportunityId =: op.id order by Product2id];
            if(opli.size() > 0){
                String tmpId = '';
                List<Invoices__c> lstInvoice = new List<Invoices__c>();
                Invoices__c objInvoice = new Invoices__c();
                Integer lm = opli.size();
                Integer i = 1;
                for(OpportunityLineItem ob: opli){
                    if(tmpId == ''){
                        tmpId = ob.Product2id;
                        objInvoice = new Invoices__c();   
                        objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                        objInvoice.Amount__c = ob.Gross__c;                                      
                    }else{
                        if(tmpId == ob.Product2id){
                            objInvoice.Amount__c = objInvoice.Amount__c + ob.Gross__c;
                        }else{
                            lstInvoice.add(objInvoice);
                            tmpId = ob.Product2id;
                            objInvoice = new Invoices__c();   
                            objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                            objInvoice.Amount__c = ob.Gross__c;                           
                        }     
                    }
                    if(i == lm){
                        lstInvoice.add(objInvoice);
                    }
                    i++;
                }
                if(lstInvoice.size() > 0){
                    try{
                        insert lstInvoice;
                        system.debug('!Lst '+lstInvoice);
                    }catch(Exception e){
                        system.debug('!Bingo '+e);
                    }
                }
            }
        }
    }
}

____________________________________

TEST CLASS

@isTest
     public class Opportunity invoiceTest
    {
     static testMethod void insertOpportunity()
    {
      Account objAccount = new Account();
      objAccount.Name = 'Vivek';
      objAccount.Type = 'Supplier';
      objAccount.Phone = '1234';
      objAccount.CurrencyIsoCode = 'AUD';
      insert objAccount;
     
      opportunity objopportunity= new opportunity ();
      objopportunity.Name = 'Hindi2014';
      objopportunity.CloseDate = system.Today();
      objopportunity.Account = 'objAccount';
      objopportunity.Vendor__c = 'objaccount.id';
      objopportunity.StageName = 'Closed Won - Signed';
      objopportunity.Billing_Terms__c = 'On Completion';              
      objopportunity.Type = 'New Business';
      insert Objopportunity;
    
     
     
   opportunitylineitem objopportunitylineitem = new opportunitylineitem();
    insert objopportunitylineitem ;
   
    Invoiceobjinvoice=new Invoice();
    objInvoices.Account_Invoice__c='Neo@Ogilvy';
    objInvoices.Amount__c='2400';
    objInvoices.Invoice_link__c='google';
    objInvoices.Invoice_Status__c='Paid';
    objInvoices.Opportunity_invoices__c='DD Test 2015';
    objInvoices.Site_or_Partner__c='RAP';
    Invoiceobjinvoice;
   
  }
}


 

“trigger makeInvoice on Opportunity (after insert, after update) {
  
    for(Opportunity op :trigger.new){
        if(op.StageName == 'Closed Won - Signed'){
           List<OpportunityLineItem> opli = new List<OpportunityLineItem>();
            opli = [select id,Gross__c, Product2id, OpportunityId from OpportunityLineItem where OpportunityId =: op.id order by Product2id];
            if(opli.size() > 0){
                String tmpId = '';
                List<Invoices__c> lstInvoice = new List<Invoices__c>();
                Invoices__c objInvoice = new Invoices__c();
                Integer lm = opli.size();
                Integer i = 1;
                for(OpportunityLineItem ob: opli){
                    if(tmpId == ''){
                        tmpId = ob.Product2id;
                        objInvoice = new Invoices__c();  
                        objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                        objInvoice.Amount__c = ob.Gross__c;                                     
                    }else{
                        if(tmpId == ob.Product2id){
                            objInvoice.Amount__c = objInvoice.Amount__c + ob.Gross__c;
                        }else{
                            lstInvoice.add(objInvoice);
                            tmpId = ob.Product2id;
                            objInvoice = new Invoices__c();  
                            objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                            objInvoice.Amount__c = ob.Gross__c;                          
                        }    
                    }
                    if(i == lm){
                        lstInvoice.add(objInvoice);
                    }
                    i++;
                }
                if(lstInvoice.size() > 0){
                    try{
                        insert lstInvoice;
                        system.debug('!Lst '+lstInvoice);
                    }catch(Exception e){
                        system.debug('!Bingo '+e);
                    }
                }
            }
        }
    }
}”
trigger makeInvoice on Opportunity (after insert, after update) {
   
    for(Opportunity op :trigger.new){
        if(op.StageName == 'Closed Won - Signed'){
           List<OpportunityLineItem> opli = new List<OpportunityLineItem>();
            opli = [select id,Gross__c, Product2id, OpportunityId from OpportunityLineItem where OpportunityId =: op.id order by Product2id];
            if(opli.size() > 0){
                String tmpId = '';
                List<Invoices__c> lstInvoice = new List<Invoices__c>();
                Invoices__c objInvoice = new Invoices__c();
                Integer lm = opli.size();
                Integer i = 1;
                for(OpportunityLineItem ob: opli){
                    if(tmpId == ''){
                        tmpId = ob.Product2id;
                        objInvoice = new Invoices__c();   
                        objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                        objInvoice.Amount__c = ob.Gross__c;                                      
                    }else{
                        if(tmpId == ob.Product2id){
                            objInvoice.Amount__c = objInvoice.Amount__c + ob.Gross__c;
                        }else{
                            lstInvoice.add(objInvoice);
                            tmpId = ob.Product2id;
                            objInvoice = new Invoices__c();   
                            objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                            objInvoice.Amount__c = ob.Gross__c;                           
                        }     
                    }
                    if(i == lm){
                        lstInvoice.add(objInvoice);
                    }
                    i++;
                }
                if(lstInvoice.size() > 0){
                    try{
                        insert lstInvoice;
                        system.debug('!Lst '+lstInvoice);
                    }catch(Exception e){
                        system.debug('!Bingo '+e);
                    }
                }
            }
        }
    }
}
trigger makeInvoice on Opportunity (after insert, after update) {
   
    for(Opportunity op :trigger.new){
        if(op.StageName == 'Closed Won - Signed'){
           List<OpportunityLineItem> opli = new List<OpportunityLineItem>();
            opli = [select id,Gross__c, Product2id, OpportunityId from OpportunityLineItem where OpportunityId =: op.id order by Product2id];
            if(opli.size() > 0){
                String tmpId = '';
                List<Invoices__c> lstInvoice = new List<Invoices__c>();
                Invoices__c objInvoice = new Invoices__c();
                Integer lm = opli.size();
                Integer i = 1;
                for(OpportunityLineItem ob: opli){
                    if(tmpId == ''){
                        tmpId = ob.Product2id;
                        objInvoice = new Invoices__c();   
                        objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                        objInvoice.Amount__c = ob.Gross__c;                                      
                    }else{
                        if(tmpId == ob.Product2id){
                            objInvoice.Amount__c = objInvoice.Amount__c + ob.Gross__c;
                        }else{
                            lstInvoice.add(objInvoice);
                            tmpId = ob.Product2id;
                            objInvoice = new Invoices__c();   
                            objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                            objInvoice.Amount__c = ob.Gross__c;                           
                        }     
                    }
                    if(i == lm){
                        lstInvoice.add(objInvoice);
                    }
                    i++;
                }
                if(lstInvoice.size() > 0){
                    try{
                        insert lstInvoice;
                        system.debug('!Lst '+lstInvoice);
                    }catch(Exception e){
                        system.debug('!Bingo '+e);
                    }
                }
            }
        }
    }
}
This is trigger
_______________________________
trigger chekDocSign on dsfs__DocuSign_Recipient_Status__c (After insert, After update) {
    for(dsfs__DocuSign_Recipient_Status__c ob :trigger.new){
        if(ob.dsfs__Date_Signed__c != null){
            dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
            Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
            objOpp.StageName = 'Closed Won - Signed';
            update objOpp;
        }else{
            if(ob.dsfs__Date_Declined__c != null){
                dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
                Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
                objOpp.StageName = 'Closed Lost (Cancelled)';
                update objOpp;
            }          
        }       
    }
}
________________________________________
Test class



@isTest
public class chekDocSignTracker
{
   Static testmethod void insertRecordwithDateSigned()
    {
             Account objAccount = new Account();
             objAccount.Name = 'Vivek';
             objAccount.Type = 'Supplier';
             objAccount.Phone = '1234';
             objAccount.CurrencyIsoCode = 'AUD';
             insert objAccount;
            
             Contact objcontact = new contact();
             objcontact.LastName = 'Singh';
             objcontact.CurrencyIsoCode = 'AUD';
             objcontact.Account = objAccount ;
             insert objContact ;
            
             opportunity objopportunity= new opportunity ();
             objopportunity.Name = 'Hindi2014';
             objopportunity.CloseDate = System.Today();
             objopportunity.Account = objAccount;
             objopportunity.Buyer__c = objcontact.id;
             objopportunity.Vendor__c = objaccount.id;
             objopportunity.StageName = 'Prposal Sent';
             objopportunity.Billing_Terms__c = 'On Completion';              
             objopportunity.Type = 'New Business';
             insert Objopportunity;
                 
      
         dsfs__DocuSign_Status__c objdocusign= new dsfs__DocuSign_Status__c();
          objdocusign.dsfs__DocuSign_Envelope_ID__c = '1234';
          objdocusign.dsfs__Opportunity__c=objopportunity.id;
          insert objdocusign;
         
          dsfs__DocuSign_Recipient_Status__c objdocuRsign = new dsfs__DocuSign_Recipient_Status__c();
          objdocuRsign.dsfs__Parent_Status_Record__c = objdocusign.ID;
          objdocuRsign.dsfs__DocuSign_Recipient_Id__c = '1234';
          objdocuRsign.Name = 'Test';
          objdocuRsign.dsfs__Date_Signed__c = System.Today();
          insert objdocuRsign ;
         
          
        
     }
  }
trigger chekDocSign on dsfs__DocuSign_Recipient_Status__c (After insert, After update) {
    for(dsfs__DocuSign_Recipient_Status__c ob :trigger.new){
        if(ob.dsfs__Date_Signed__c != null){
         dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
         Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
         objOpp.StageName = 'Closed Won - Signed';
         update objOpp;
        }else{
            if(ob.dsfs__Date_Declined__c != null){
                dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
          Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
          objOpp.StageName = 'Closed Lost (Cancelled)';
          update objOpp;
            }          
        }       
    }
}
Public class opportunityTriggerHandler
{
   
    public void createNewContact(List<Opportunity> triggerNew)
    {
     system.debug('opportunityTriggerHandler called createNewContact');
        List<OpportunityContactRole> lstOppContactRole = new list<OpportunityContactRole>();
        if(triggerNew != null && triggerNew.size() > 0)
        {
         system.debug('opportunityTriggerHandler in null check');
            for(Opportunity objOpp : triggerNew)
            {
             system.debug('opportunityTriggerHandler in loop');
                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;
       
        system.debug('lstOppContactRole::::::' + lstOppContactRole);
    }
}

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



public class insertionOrderPdf {
public String OppId;
public String OpportunityNumber{get;set;}
Public boolean site{get;set;}
Public integer discount{get;set;}
public String SiteType{get;set;}
Public List<OpportunityLineItem> lstOpplineItem{get;set;}
Public Opportunity PrimaryOpp{get;set;}
public insertionOrderPdf()
    {
        OppId           = Apexpages.currentPage().getParameters().get('OppId');
        SiteType        = Apexpages.currentPage().getParameters().get('SiteType');
       
        if(OppId != Null && SiteType!= Null)
        {
                PrimaryOpp              =       new Opportunity();
                lstOpplineItem  =       new List<OpportunityLineItem>();
                lstOpplineItem  =   [
                                                        select
                                                        Opportunity.Billing_Notes__c,
                                                        Opportunity.Billing_Terms__c,
                                                        Opportunity.Name,
                                                        Opportunity.Client_PO_Number__c,
                                                        Opportunity.Activity_Start_Date__c,
                                                        Opportunity.Activity_End_Date__c,
                                                        Opportunity.Description,
                                                        Opportunity.Account.Name,
                                                        Opportunity.Account.billingPostalcode,
                                                        Opportunity.Account.Billing_Email__c,
                                                        Opportunity.Account.BillingStreet,
                                                        Opportunity.Account.BillingCity,
                                                        Opportunity.Account.BillingCountry,
                                                        Opportunity.Account.BillingState,
                                                        Opportunity.Buyer__r.Name,
                                                        Opportunity.Buyer__r.Email,
                                                        Opportunity.Buyer__r.Phone,
                                                        Opportunity.Buyer__r.Title,
                                                        Opportunity.Vendor__r.name,
                                                        Opportunity.Success_metrics__c,
                                                        Opportunity.Agency_Discount_Percentage__c,
                                                        Opportunity.Order_Notes__c,
                                                        PricebookEntry.Product2.Name,
                                                        Opportunity.Opp_Number__c,
                                                        Description,
                                                        Start_Date__c,
                                                        End_Date__c,
                                                        Geo_Target__c,
                                                        Quantity,
                                                        ListPrice,
                                                        Gross__c,
                                                        UnitPrice,
                                                        TotalPrice,    
                                                        Site__c
                                                        from    OpportunityLineItem
                                                        where OpportunityId =:OppId
                                                        and      Site__c =:SiteType
                                                        ];
                                                       
                if(lstOpplineItem.size() > 0)
                {
                        if(lstOpplineItem[0].site__c.tolowercase() == 'inform')
                        {
                            Site = true;
                        }
                        PrimaryOpp = lstOpplineItem[0].Opportunity;
                        if(PrimaryOpp.Opp_Number__c!= null)
                        {
                            if(PrimaryOpp.Opp_Number__c.contains('-'))
                            {
                             String[] s = new String[]{};
                             s = PrimaryOpp.Opp_Number__c.split('-');
                             OpportunityNumber = s[1];
                            }
                        } 
                                            
                        if(PrimaryOpp.Agency_Discount_Percentage__c == '10%')
                        {
                            discount = 10;
                        }else if(PrimaryOpp.Agency_Discount_Percentage__c == '15%')
                        {
                            discount = 15;
                        }
                        else if(PrimaryOpp.Agency_Discount_Percentage__c == '20%')
                        {
                            discount = 20;
                        }
                        else
                        {
                            discount = 0;
                        }
                }
        }
    }

}
<apex:page controller="theController." extensions="theController">
   <apex:form>
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection>
            <apex:pageBlockSectionItem>
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup>
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}"
                                      rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l"
                               rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
Hi i m new in salesforce please tell me whats use in forecaste in salesforce  please help me
Global class EmailToLeadActivity implements Messaging.inboundEmailHandler
{  
    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,Messaging.InboundEnvelope env )
    { System.debug('Hello----------------------------------------------------------------');
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
 
            String myPlainText= 'True';
            System.debug('Email+true');
            myPlainText = email.plainTextBody;
            Task[] newTask = new Task[0];
   try
   {
    Ticket__c vLed = [SELECT Id, Name, Email__c FROM Ticket__c WHERE Email__c =: email.fromAddress
        LIMIT 1];
       system.debug('-------------------' + vLed);
   newTask.add(new Task(Description =  myPlainText,
           Priority = 'Normal',
           Status = 'Inbound Email',
           Subject = email.subject,
           IsReminderSet = true,
           ReminderDateTime = System.now()+1,
           WhoId =  vLed.Id));
     insert newTask;   
    
     System.debug('New Task Object: ' + newTask );  
    }
       catch (QueryException e) {
       System.debug('Query Issue: ' + e);
   }

   result.success = true;
   return result;
  }
}
What is data migration whats used in salesforce please reply How to work 
Error: Compile Error: Entity is not org-accessible at line 2 column 9



how i solve it
my test class is --------------------------------------------------------------------

@isTest
private class invoiceTrackerTestSuite {
static testMethod void runPositiveTestCases() {
      Account objAccount = new Account();
      objAccount.Name = 'Vivek';
      objAccount.Type = 'Supplier';
      objAccount.Phone = '1234';
      objAccount.CurrencyIsoCode = 'AUD';
      insert objAccount;
      Contact objcontact = new contact();
      objcontact.LastName = 'Singh';
      objcontact.CurrencyIsoCode = 'AUD';
      objcontact.Account = objAccount ;
      insert objContact;
     
      opportunity objopportunity= new opportunity ();
      objopportunity.Name = 'Hindi2014';
      objopportunity.CloseDate = system.Today();
      objopportunity.Account = 'objAccount';
      objopportunity.Vendor__c = 'objaccount.id';
      objopportunity.StageName = 'Closed Won - Signed';
      objopportunity.Billing_Terms__c = 'On Completion';              
      objopportunity.Type = 'New Business';
      insert Objopportunity;
    
     
     
   opportunitylineitem objopportunitylineitem = new opportunitylineitem();
    insert objopportunitylineitem ;
   
    Invoiceobjinvoice=new Invoice();
    objInvoices.Account_Invoice__c='Neo@Ogilvy';
    objInvoices.Amount__c='2400';
    objInvoices.Invoice_link__c='google';
    objInvoices.Invoice_Status__c='Paid';
    objInvoices.Opportunity_invoices__c='DD Test 2015';
    objInvoices.Site_or_Partner__c='RAP';
    insert objinvoice;
   
  }
}
Hi experts,

I am going to use standard mass email contact option. When i select mass email then i can able to select upto 250 contacts and we can send.

But the trick is , when i selected more than 50 records it should through a error..

How can i achieve this?
“trigger makeInvoice on Opportunity (after insert, after update) {
  
    for(Opportunity op :trigger.new){
        if(op.StageName == 'Closed Won - Signed'){
           List<OpportunityLineItem> opli = new List<OpportunityLineItem>();
            opli = [select id,Gross__c, Product2id, OpportunityId from OpportunityLineItem where OpportunityId =: op.id order by Product2id];
            if(opli.size() > 0){
                String tmpId = '';
                List<Invoices__c> lstInvoice = new List<Invoices__c>();
                Invoices__c objInvoice = new Invoices__c();
                Integer lm = opli.size();
                Integer i = 1;
                for(OpportunityLineItem ob: opli){
                    if(tmpId == ''){
                        tmpId = ob.Product2id;
                        objInvoice = new Invoices__c();  
                        objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                        objInvoice.Amount__c = ob.Gross__c;                                     
                    }else{
                        if(tmpId == ob.Product2id){
                            objInvoice.Amount__c = objInvoice.Amount__c + ob.Gross__c;
                        }else{
                            lstInvoice.add(objInvoice);
                            tmpId = ob.Product2id;
                            objInvoice = new Invoices__c();  
                            objInvoice.Opportunity_invoices__c = ob.OpportunityId;
                            objInvoice.Amount__c = ob.Gross__c;                          
                        }    
                    }
                    if(i == lm){
                        lstInvoice.add(objInvoice);
                    }
                    i++;
                }
                if(lstInvoice.size() > 0){
                    try{
                        insert lstInvoice;
                        system.debug('!Lst '+lstInvoice);
                    }catch(Exception e){
                        system.debug('!Bingo '+e);
                    }
                }
            }
        }
    }
}”
This is trigger
_______________________________
trigger chekDocSign on dsfs__DocuSign_Recipient_Status__c (After insert, After update) {
    for(dsfs__DocuSign_Recipient_Status__c ob :trigger.new){
        if(ob.dsfs__Date_Signed__c != null){
            dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
            Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
            objOpp.StageName = 'Closed Won - Signed';
            update objOpp;
        }else{
            if(ob.dsfs__Date_Declined__c != null){
                dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
                Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
                objOpp.StageName = 'Closed Lost (Cancelled)';
                update objOpp;
            }          
        }       
    }
}
________________________________________
Test class



@isTest
public class chekDocSignTracker
{
   Static testmethod void insertRecordwithDateSigned()
    {
             Account objAccount = new Account();
             objAccount.Name = 'Vivek';
             objAccount.Type = 'Supplier';
             objAccount.Phone = '1234';
             objAccount.CurrencyIsoCode = 'AUD';
             insert objAccount;
            
             Contact objcontact = new contact();
             objcontact.LastName = 'Singh';
             objcontact.CurrencyIsoCode = 'AUD';
             objcontact.Account = objAccount ;
             insert objContact ;
            
             opportunity objopportunity= new opportunity ();
             objopportunity.Name = 'Hindi2014';
             objopportunity.CloseDate = System.Today();
             objopportunity.Account = objAccount;
             objopportunity.Buyer__c = objcontact.id;
             objopportunity.Vendor__c = objaccount.id;
             objopportunity.StageName = 'Prposal Sent';
             objopportunity.Billing_Terms__c = 'On Completion';              
             objopportunity.Type = 'New Business';
             insert Objopportunity;
                 
      
         dsfs__DocuSign_Status__c objdocusign= new dsfs__DocuSign_Status__c();
          objdocusign.dsfs__DocuSign_Envelope_ID__c = '1234';
          objdocusign.dsfs__Opportunity__c=objopportunity.id;
          insert objdocusign;
         
          dsfs__DocuSign_Recipient_Status__c objdocuRsign = new dsfs__DocuSign_Recipient_Status__c();
          objdocuRsign.dsfs__Parent_Status_Record__c = objdocusign.ID;
          objdocuRsign.dsfs__DocuSign_Recipient_Id__c = '1234';
          objdocuRsign.Name = 'Test';
          objdocuRsign.dsfs__Date_Signed__c = System.Today();
          insert objdocuRsign ;
         
          
        
     }
  }
Public class opportunityTriggerHandler
{
   
    public void createNewContact(List<Opportunity> triggerNew)
    {
     system.debug('opportunityTriggerHandler called createNewContact');
        List<OpportunityContactRole> lstOppContactRole = new list<OpportunityContactRole>();
        if(triggerNew != null && triggerNew.size() > 0)
        {
         system.debug('opportunityTriggerHandler in null check');
            for(Opportunity objOpp : triggerNew)
            {
             system.debug('opportunityTriggerHandler in loop');
                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;
       
        system.debug('lstOppContactRole::::::' + lstOppContactRole);
    }
}

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



<apex:page controller="theController." extensions="theController">
   <apex:form>
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection>
            <apex:pageBlockSectionItem>
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup>
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}"
                                      rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l"
                               rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
Hi i m new in salesforce please tell me whats use in forecaste in salesforce  please help me
Global class EmailToLeadActivity implements Messaging.inboundEmailHandler
{  
    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,Messaging.InboundEnvelope env )
    { System.debug('Hello----------------------------------------------------------------');
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
 
            String myPlainText= 'True';
            System.debug('Email+true');
            myPlainText = email.plainTextBody;
            Task[] newTask = new Task[0];
   try
   {
    Ticket__c vLed = [SELECT Id, Name, Email__c FROM Ticket__c WHERE Email__c =: email.fromAddress
        LIMIT 1];
       system.debug('-------------------' + vLed);
   newTask.add(new Task(Description =  myPlainText,
           Priority = 'Normal',
           Status = 'Inbound Email',
           Subject = email.subject,
           IsReminderSet = true,
           ReminderDateTime = System.now()+1,
           WhoId =  vLed.Id));
     insert newTask;   
    
     System.debug('New Task Object: ' + newTask );  
    }
       catch (QueryException e) {
       System.debug('Query Issue: ' + e);
   }

   result.success = true;
   return result;
  }
}

We have Contact us (web2lead) form on our company website. In that contact us form we have asked only four fields Name, Email, Phone and State. Name field is feeding custom Customer Name field (Type Text , size = 255), Email field is feeding Standard Email field, Phone is feeding Standard Phone field and State is feeding Standard State/Province field in salesforce. 

 

I am trying to make a workflow field update that split Customer Name and feed First name and Last name Standard fields but I am not sure which formula functions should I use for splitting. Anyone has any Idea?

I've written a pretty simple trigger and I was hoping to get a hand with a test class.

 

All my trigger does is stamp the account with the same user lookup value from an opportunity (CF Manager -> Account CF Owner fields).  I'm brand new to Apex so help is always appreciated.  The trigger fires without issue.

 

Here's the trigger:

 

trigger OnAccountOpportunityCFManager on Opportunity (before insert, before update) {
    List<Id> AccountsToUpdate = new List<Id>{}; 
    // Find account to update
    for(Opportunity o: Trigger.new){
        if (o.CF_Manager__c != Null && o.AccountId != Null)  {
            AccountsToUpdate.add(o.AccountId);
        }
    // Pull field data from account
    List<Account> accts = new List<Account>([SELECT Id, Account_CF_Owner__c FROM Account WHERE Id IN :AccountsToUpdate]);
    // Update account    
    for(Account a: accts) {
    a.Account_CF_Owner__c = o.CF_Manager__c;
    update a;
    }
    }
}

 Thanks!

When you create and event with multiple attendees, 1 event record is created for each attendee. Is there a definitive way to determine which is the source or master event of the group?

 

In the data, all events would have IsGroup=true. The event records created for the added attendees would have IsChild = true.

 

Question is, if I only have the event of one of the child records, how can I programatiically determine what the master or source event is for the group that the child event belongs to?

  • January 23, 2009
  • Like
  • 2