• bouscal
  • NEWBIE
  • 325 Points
  • Member since 2005
  • Salesforce Administrator
  • AudaExplore, a Solera company

  • Chatter
    Feed
  • 6
    Best Answers
  • 3
    Likes Received
  • 1
    Likes Given
  • 42
    Questions
  • 144
    Replies
I need to have a trigger that updates a date field on our opportunity page when an opportunity stage is changed.

The field I need to update with the date is called "Current Stage Date"

I tried doing it with a workflow but it updates the date everything the opportunity reocord is edited.

I have never written a trigger so any help would be great!

Thanks,

Michael

 

Error Generated by request

from (object) where (field) [opporation] YYYY-MM-DDTHH:MM:SS.000Z

 

Error at row:1:Column:41

value of filter criterion for field 'xxxxx__C' must be of type date and should not be enclosed in quotes

ExceptionCode : 5077

 

 

i changed the code in the connector's utils Module

 

        'commented out to fix queries for field equals date
        'sfQueryValueFormat = Format$(vlu, "yyyy-mm-ddTHH:MM:SS.000Z")
       
        'changed format to fix queries for field equals date

        sfQueryValueFormat = Format$(vlu, "yyyy-mm-dd")

 

 

this seems to work so far in queries that use just a date.

 

no idea yet how it would impact queries that involved both date and time.

 

 

Has anyone else come up with a better solution ?

 

 

Use at YOUR OWN RISK. be safe make backups

 

 

Product is a standard lookup field on the Case object yet a soql query doesn't see it.  I'm an admin.  I have full rights to the object & field.  The field is on a page layout.  Why isn't it available to query?  I also noticed a describe call doesn't return the field either.
 
SELECT ID, Product FROM Case WHERE ID='500L000000DTFao'
           ^
ERROR at Row:1:Column:12
No such column 'Product' on entity 'Case'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.


 
Here's my code, page, extension & test.  No coverage for the entire list of attachments.
Extension:
public class CaseListController {
    
    private final Case cas; 
    private String sortOrder = 'CreatedDate'; 
    public Case cCas;
    public Case pCas; 
    public Id theParent;
    
    public CaseListController(ApexPages.StandardController stdController) {
        this.cas = (Case)stdController.getRecord();
        cCas=[SELECT id, parentid, casenumber FROM case WHERE id=:cas.id];
        pCas=[SELECT id FROM case WHERE id=:cCas.ParentId]; 
        theParent=pCas.id;
        System.debug('The Parent Record is: ' + theParent); 
    }
    
    public List<Attachment> getAttachments() {
        List<Attachment> results; 
        If(theParent != null){
            results = Database.query(
                'SELECT Id, parentid, parent.name, name, CreatedDate, ContentType, ownerid ' + 
                'FROM Attachment ' + 
                ' WHERE parentid =:theParent ' + 
                'ORDER BY ' + sortOrder + ' DESC ' + 
                'LIMIT 10'
            ); 
        } 
        return results;
    }
}
Page: 
<apex:page standardcontroller="Case" extensions="CaseListController" sidebar="false" showHeader="false" >
    <apex:form >
        <apex:pageBlock title="Parent Attachments" id="attachments_list"> 
            <apex:pageBlockTable value="{! attachments }" var="at">
                <apex:column headervalue="File">
                    <apex:outputLink value="/servlet/servlet.FileDownload?file={! at.id}" target="_blank">{! at.Name}
                    </apex:outputLink>
                </apex:column>
                <apex:column value="{! at.contenttype }"/>
                <apex:column value="{! at.createddate }"/>
                <apex:column value="{! at.ownerid }"/>
                <apex:column value="{! at.parent.name }" headerValue="Case"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Test:  
@isTest
public class CaseListController_Test {

    public static testMethod void testMyController() {
        Account testAccount = new Account();
		testAccount.Name='Test Account'; 
        testAccount.Phone='(999) 999-9999';
        
        Case ParentCase = new Case();
        ParentCase.AccountId = testAccount.id; 
        ParentCase.RecordTypeId='012L000000073y2';
        ParentCase.Reason__c='Move User';
        ParentCase.Subject = 'Test Parent Case'; 
        ParentCase.Description = 'Test Parent Case'; 
        insert ParentCase; 
        
        Case ChildCase = new Case();
        ChildCase.AccountId = testAccount.id; 
        ChildCase.ParentId = ParentCase.id;
        ChildCase.RecordTypeId='012L000000073y2';
        ChildCase.Reason__c='Move User';
        ChildCase.Subject = 'Test Parent Case'; 
        ChildCase.Description = 'Test Parent Case'; 
        insert ChildCase; 
        
        Attachment atch = new Attachment();
        Blob bodyBlb=Blob.valueOf('test body');
        atch.Name='test attachment'; 
        atch.parentid=ParentCase.Id; 
        atch.Body=bodyBlb;
        insert atch;
        
        Test.startTest();
        PageReference pageRef = Page.ParentCaseAttachments;
        pageRef.getParameters().put('Id',ChildCase.Id);
        Test.setCurrentPage(pageRef);
        
        ApexPages.StandardController sc = new ApexPages.StandardController(ChildCase);
        CaseListController ext = new CaseListController(sc);
        Test.stopTest();
    }
}

Any direction is appreciated!
  • September 11, 2018
  • Like
  • 0
I'd like a visual force page that shows all the tasks from a parent case record on it's child case(s).
I'm not sure if I'll need to extend the standard Task contoller due to the whatid having a possiblity of holding any object but I'd think starting from a Case and passing a specific ID would be pretty straightforward.  Any suggestions?
 
Hello gurus,
I'm trying to be a better developer by writing the test code first.  I can't create all the needed test objects.  Account, Contact, Case are created and I can see the IDs in the debug log but get an error when creating the Asset.  What am I overlooking?

There is no other code created yet.
 
@IsTest(SeeAllData=True)

public class AssetUpdateTest {
    
    public static testmethod void testAssetLink()    {
        Account acc = createAccount(); 
        Contact con = createContact(acc); 
        Case cas = createCase(acc,con); 
        Asset ast = createAsset(acc,con,cas); 

        System.debug('**************************   Case ID: ' + cas.id); 
        System.debug('**************************   Case.Asset: ' + cas.AssetId);
        
    }
    
    public static Account createAccount(){
        Account theAccount = new Account(
            recordtypeid='01270000000Q7rQ', 
            name='Test Account', 
            Status__c='Client',
            Line_of_Business__c='CRS',
            phone='8005551212', 
            currencyisocode='USD'); 
        
        insert theAccount;
        return theAccount; 
    }    
    
    public static Contact createContact(Account theAccount){
        Contact theContact = new Contact(
            recordtypeid='01270000000Q7ra',
            email='tim.bouscal@audatex.com', 
            firstname='George', 
            lastname='Washington',
            accountid=theAccount.id);
        insert theContact;        
        return theContact; 
    }
    
    public static Case createCase(Account acc, Contact con){
        Case theCase = new Case(
            recordtypeid='01270000000Dy9u', 
            AccountId = acc.Id, 
            ContactId = con.Id,             
            
            Requestor__c=con.Id, 
            Reason='New Account Setup', 
            Reason_Detail__c='New - ADXE Shop 02',
            Status='New', 
            Origin='Sales Request', 
            Subject='AssetUpdateTest Sample BisOps Case', 
            Description='This is a sample case for testig the AssetUpdate class'
        ); 
        insert theCase; 
        return theCase;
    }    
    
    public static Asset createAsset(Account acc, Contact con, Case cas){
        System.debug('***** ***** ***** Account ID: ' + acc.id + '     Contact Id: ' + con.id + '     Case ID: '+ cas.Id); // all 3 values show in debug log
        Asset theAsset = new Asset(
            Name='Test Asset', 
            Account = acc, 
            Contact = con, 
            Case_Number__c = cas.CaseNumber, 
            Type__c='New', 
            Status='Purchased', 
            Description='This is a test asset for testing the AssetUpdate class'
        );
        insert theAsset; 
        return theAsset; 
    }
}

Error: 
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Every asset needs an account, a contact, or both.: [AccountId, ContactId]

Class.AssetUpdateTest.createAsset: line 69, column 1
Class.AssetUpdateTest.testAssetLink: line 9, column 1

 
Spring ’17 Release
Gain Greater Insight with Analytics Cloud 

Q3: How can you pin apps on your Analytics Home?

My answer: (A) Click Pin Apps from the top of Analytics Home

This was marked as incorrect yet after reviewing the release notes, and the trailhead module, I can find no other acceptable answer.  

(B) Order the apps when prompted the first time you visit Analytics Home is wrong - module states that they are ordered as pinned.
(C) Analytics Setting page - no documentation of any such page
(D) A and B - B is wrong so D is wrong
(E) All of the above - B is wrong so E is wrong.

What did I miss or is the question/answer wrong?
I'd like an Action on the Case object to create a child case with several values populated from the parent Case.  I'm reviewing the code here and attempting to make some modifications.  Any direction will be appreciated.

Controller: 
public with sharing class CreateCaseExtension {
    private final SObject parent;
    public Case theCase {get; set;}
    public Case pCase {get; set;}
    public String lastError {get; set;}
    
    public CreateCaseExtension(ApexPages.StandardController controller) {
        parent = controller.getRecord();
        pCase = (Case) controller.getRecord();
        theCase = new Case();
        theCase.accountId = parent.accountid;
        theCase.contactId = parent.contactid;
        lastError = '';
    }
      
    public PageReference createCase() {
        createNewCase();
        theCase = new Case();
        theCase.AccountId = parent.accountId; 
        theCase.ContactId = parent.ContactId;
        theCase.parentid= pCase.id;
        theCase.Product_Group__c = pCase.Product_Group__c; 
        theCase.Product__c = pCase.Product__c; 
        theCase.Origin = 'Tech Support';
        return null;
    }
       
     private void createNewCase() {      
        try {
            insert theCase;
            
            FeedItem post = new FeedItem();
            post.ParentId = ApexPages.currentPage().getParameters().get('id');
            post.Body = 'created a case';
            post.type = 'LinkPost'; 
            post.LinkUrl = '/' + theCase.id;
            post.Title = theCase.Subject;
            insert post;
        } catch(System.Exception ex){
           lastError = ex.getMessage();
        }
    }   
}

VF Page: 
<apex:page standardcontroller="Case" extensions="CreateCaseExtension" showHeader="false">

    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/> 
    <style>
        .requiredInput .requiredBlock, .requiredBlock {background-color: white;} 
        .custompubblock div {display: inline-block;} 
        .custompublabel {width:54px;} 
    </style>
    <script> 
        function refreshFeed() { 
            Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {feed:true}}); 
        }
    </script>   
    <div> 
        <apex:form > 
            <apex:actionFunction action="{!createCase}" name="createCase" rerender="out" 
            oncomplete="refreshFeed();"/> 
            <apex:outputPanel id="out" > 
                <div class="custompubblock"> 
                    <div class="custompublabel">Case:</div><apex:inputField value="{!pCase.id}" 
                    style="margin-left:0;"/>&nbsp;&nbsp;&nbsp;
                    <div>Contact:&nbsp;</div><apex:inputField value="{!pCase.contactId}" />
                </div>
                <apex:inputField value="{!pCase.description}" style="width:538px;height:92px;margin-top:4px;" />
                <div class="custompubblock" style="margin-top:5px;"> 
                    <div>Status:&nbsp;</div><apex:inputField value="{!pCase.status}" />&nbsp;&nbsp;&nbsp; 
                    <div>Priority:&nbsp;</div><apex:inputField value="{!pCase.Product_Group__c}" />&nbsp;&nbsp;&nbsp; 
                    <div>Case Origin:&nbsp;</div><apex:inputField value="{!pCase.origin}" /> 
                </div> 
            </apex:outputPanel>
        </apex:form><br/>
        <button type="button" onclick="createCase();" 
        style="position:fixed;bottom:0px;right:0px;padding:5px 10px; 
        font-size:13px; font-weight:bold; line-height: 
        18px;background-color:#0271BF;background-image:-moz-linear-gradient(#2DADDC, #0271BF);background-repeat:repeat-x;border-color:#096EB3;" 
        id="addcasebutton">Create Case</button> 
    </div>  
</apex:page>

 
I was advised that Winter '17 has a customer self-scheduling component for the Field Service Lightning package.  I cannot find any documentation on how to set this component up in the Community.  Plenty of docs on Communities and configuring but nothing specific to client self-scheduling.
Any pointers?
I have the following test class, created by a 3rd party, that is causing issues when I attempt to edit other Apex or deploy new.  What is causing the error?
 
@isTest
private class TestAddAgreementEventToChatterFeed
{
    private static testMethod void myTest()
    {
        Contact objContact = new Contact();
        objContact.LastName = 'Test';
        List<echosign_dev1__SIGN_AgreementEvent__c > lstAE = new List<echosign_dev1__SIGN_AgreementEvent__c> ();
        insert objContact;
    
        echosign_dev1__SIGN_Agreement__c objA1 = new echosign_dev1__SIGN_Agreement__c();
        objA1.echosign_dev1__Recipient__c = objContact.Id;
        objA1.Name = 'Test Agreement 1';
        insert objA1;
        
        echosign_dev1__SIGN_Agreement__c objA2 = new echosign_dev1__SIGN_Agreement__c();
        objA2.echosign_dev1__Recipient__c = objContact.Id;
        objA2.Name = 'Test Agreement 2';
        insert objA2;
    
        echosign_dev1__SIGN_Agreement__c objA3 = new echosign_dev1__SIGN_Agreement__c();
        objA3.echosign_dev1__Recipient__c = objContact.Id;
        objA3.Name = 'Test Agreement 3';
        insert objA3;
        
        echosign_dev1__SIGN_AgreementEvent__c objAE1 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE1.echosign_dev1__SIGN_Agreement__c = objA1.Id;
        lstAE.add(objAE1);
        
        echosign_dev1__SIGN_AgreementEvent__c objAE2 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE2.echosign_dev1__SIGN_Agreement__c = objA2.Id;
        objAE2.echosign_dev1__Description__c= 'signed';
        lstAE.add(objAE2);
        
        echosign_dev1__SIGN_AgreementEvent__c objAE3 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE3.echosign_dev1__SIGN_Agreement__c = objA3.Id;
        objAE3.echosign_dev1__Description__c= 'sent out';
        lstAE.add(objAE3);
    
        insert lstAE;
        
    }
}

 
I have the following class, developed by a third party, that is now causing issues when attempting to deploy other code.
I fail to see the web service callout here that is causing the error.
 
@isTest
private class TestAddAgreementEventToChatterFeed
{
    private static testMethod void myTest()
    {
        Contact objContact = new Contact();
        objContact.LastName = 'Test';
        List<echosign_dev1__SIGN_AgreementEvent__c > lstAE = new List<echosign_dev1__SIGN_AgreementEvent__c> ();
        insert objContact;
    
        echosign_dev1__SIGN_Agreement__c objA1 = new echosign_dev1__SIGN_Agreement__c();
        objA1.echosign_dev1__Recipient__c = objContact.Id;
        objA1.Name = 'Test Agreement 1';
        insert objA1;
        
        echosign_dev1__SIGN_Agreement__c objA2 = new echosign_dev1__SIGN_Agreement__c();
        objA2.echosign_dev1__Recipient__c = objContact.Id;
        objA2.Name = 'Test Agreement 2';
        insert objA2;
    
        echosign_dev1__SIGN_Agreement__c objA3 = new echosign_dev1__SIGN_Agreement__c();
        objA3.echosign_dev1__Recipient__c = objContact.Id;
        objA3.Name = 'Test Agreement 3';
        insert objA3;
        
        echosign_dev1__SIGN_AgreementEvent__c objAE1 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE1.echosign_dev1__SIGN_Agreement__c = objA1.Id;
        lstAE.add(objAE1);
        
        echosign_dev1__SIGN_AgreementEvent__c objAE2 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE2.echosign_dev1__SIGN_Agreement__c = objA2.Id;
        objAE2.echosign_dev1__Description__c= 'signed';
        lstAE.add(objAE2);
        
        echosign_dev1__SIGN_AgreementEvent__c objAE3 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE3.echosign_dev1__SIGN_Agreement__c = objA3.Id;
        objAE3.echosign_dev1__Description__c= 'sent out';
        lstAE.add(objAE3);
    
        insert lstAE;
        
    }
}

 
I've got 70% coverage and don't understand how to write a test that will check the Event created when the Asset is updated.
Lines that are NOT covered by my current test will be appended with /* not covered */
 
/*  
/* 
/* Create an Event when Asset is Migrated
/* 
/* */

public class CreateEvent{
    public static void newCompanyEvent(Asset[] asid){
        String strAccountSite=null;  // Account.Site field value
        Id conId=null; 
        Id assId=null; 
        Id accId=null; 
        Id recId='01270000000DtPb'; 
        Id ownId='00570000001fIep'; 
        
        Datetime dtTargetDateTime=datetime.now();  // Target date/time for Event
       // dtTargetDateTime=dtTargetDateTime.addDays(365); 
        Date dtTargetDate=dtTargetDateTime.date();  // Target date for Event
		Map<Id, String> assSiteMap = new Map<Id, String>();  
        for (Asset a:asid){
            assSiteMap.put(a.AccountId, null); /* not covered */
        }
        
        List<Account> accList = new List<Account>([SELECT Id, Site FROM Account 
                                                  WHERE Id IN: assSiteMap.keyset()]); 
        for(Account ac:accList){
            assSiteMap.put(ac.id, ac.Site);  /* not covered */
        }
        
        List<Event> ev = new List<Event>();
        
        for (Asset a:asid){
            conId=a.ContactId;  /* not covered */
            accId=a.AccountId;  /* not covered */
            strAccountSite=assSiteMap.get(accId);  /* not covered */
            
            Event newEvent= new Event(  /* not covered */
                ownerid=ownId,
                Subject='Company "Go Live"', 
                ActivityDate=dtTargetDate,
                StartDateTime=dtTargetDateTime, 
                EndDateTime=dtTargetDateTime,
                Location=strAccountSite, 
                ShowAs='Free', 
                IsAllDayEvent=TRUE, 
                Event_Status__c='Scheduled',
                Type='Non-Visit',
                Purpose__c='Sales',
                Reason__c='Conversion',
                Whoid=conId, 
                Whatid=assId, 
                RecordTypeId=recId);       
            ev.add(newEvent);            /* not covered */
        }
        insert ev; 
    }
}
and here is my current test class
@isTest(SeeAllData=true)
public class CreateEvent_test {
    
    static testMethod void testAll(){
      
        id idRecType=null; 
        TestObject to = new TestObject(); 
        Account acc = to.getAccount(true); 
        Contact con = to.getContact(acc.id, true); 
        Opportunity opp = to.getOpportunity(acc.id, con.Id, true); 
        opp.Product_Group__c='Company Enterprise'; 
        update opp; 
        

        Asset ass = to.getAsset(acc.id, con.id, opp.id, true); 
        ass.status='Migrated'; 
        ass.Product_Group__c='Product X'; 

        update ass; // this should fire the trigger to create the Event
        List<Event> ev = new List<Event>([SELECT id, subject FROM event WHERE whatid=:ass.Id]);
        test.startTest();           
        for(Event e:ev){    

            // validate success
            System.assertEquals(e.subject, 'Company "Go Live"'); 
            System.assertEquals(e.AccountId, acc.id); 
            System.assertEquals(e.WhoId, con.id); 
            // System.assertEquals(e.Location)
        }
        test.stopTest(); 
    }
}



 
Not sure what's going on, the parent cases get insert but the child cases do not.
 
List <Case> lCase = new List<Case>();
        List <Case> nCase = new List<Case>();
        for(integer i=0; i<20; i++){
        	Case cas1 = new Case(
                recordtypeid=rsc,
                accountid=acc1.id,
                contactid=con1.id,
                Case_Name__c='John Doe',
                case_phone_number__c='(800) 555-1212', 
                subject='Test Recycling Case',
                origin = 'Phone',
                status='Escalated to Management',
                Escalated_To__c='Return to Liaison',
                description='This is a parent Case');
           if(math.mod(i,2)==0){
                cas1.Case_Phone_Number__c='(800) 555-1212';
            }
			lCase.add(cas1);
        
            Case cas2 = new Case(
                recordtypeid=pdc,
                parentid=cas1.id,
                accountid=acc1.id,
                contactid=con1.id,
                status='Closed',
                Case_Name__c='John Doe',
                case_phone_number__c='(800) 555-1212', 
                subject='Escalation: Test Recycling Case',
                description='This is an escalated Case');
                nCase.add(cas2);
        }

I've also tried adding the children cases to the same list as the parents and inserting them all at once, which works, but doesn't hold the link to the parent.  They're all standalone cases.
 
Need some help understanding when to use before or after triggers and new or old.  Spefically I have the following issue;
When a Case is Escalated I want to create a child Case of a different record type but only if one doesn't already exist.  this works.
* If the child Case already exists I want to update it's status (from Closed to Open).  * System.FinalException: Record is read-only:
When the child Case is closed I want to update the Parent. this works
Also, when the Child is Closed I want to update the Parent. this works.

I have the code to do all of that but I get read only errors trying to update the Child.  I have tried with many combinations of before/after new/old
I want to loop through a list of existing Cases and capture the Parent Case into another list.
What's the best way to accomplish this?  This code doesn't work because I'm trying to add an ID as an Object, so how do I add the sObject?
List<Case> childCases = new List<Case>([SELECT id, parentid FROM Case WHERE condition exists]);

List<Case> parentCases = new List<Case>();
for(Case c:childCases{
  parentCases.add(childCases.ParentId);
}

 
I see that the List object has a remove(index) method but how do I find the index of a specific item in the list?
I thought I could loop through the list and if certain conditions were true then I could remove that specific item using the list iterator but I get an error message stating
Method does not exist or incorrect signature: [LIST<Case>].remove(Id)
Here is the segment of code that is failing;
 
List<Case> RecChildren = new List<Case>();
        RecChildren=[SELECT id,status, casenumber,parentid,subject, recordtypeid FROM Case WHERE parentid IN:RecIds];
        for(Case c:RecChildren){

            if(c.RecordTypeId!=pdc){
                RecChildren.remove(c.id);
            } else {
                if(c.Status=='Closed'){
                    c.status='Open'; 
                }
            }
        }
        update RecChildren;





 
I am trying to understand what I am doing wrong here.  I have defined a Set that will hold IDs then used the .add method to add the ID from a Case but it fails.  I've redefined the Set as a set of strings as well but either way I get a null pointer exception even though there is always at least 1 record in the list.

Here's a snippet of my class
Set<id> RecIds; 
for(Case c:cs){
            System.debug('***** entering loop c:cs cs.size() = ' + cs.size() + ' *****' );
            if(c.RecordTypeId==rsc){
                System.debug('***** inside rsc IF statement c.id = ' + c.id + ' ***** ');
            	RecIds.add(c.id);
                System.debug('***** c.id ' + c.id + ' was added to RecIds *****');
            }
and here's the debug log
 
15:04:01.036 (15036876514)|SYSTEM_METHOD_ENTRY|[24]|System.debug(ANY)
15:04:01.036 (15036881962)|USER_DEBUG|[24]|DEBUG|***** entering loop c:cs cs.size() = 1 *****
15:04:01.036 (15036886758)|SYSTEM_METHOD_EXIT|[24]|System.debug(ANY)
15:04:01.036 (15036944939)|SYSTEM_METHOD_ENTRY|[25]|Id.compareTo(Id, Id, Boolean)
15:04:01.036 (15036972914)|SYSTEM_METHOD_EXIT|[25]|Id.compareTo(Id, Id, Boolean)
15:04:01.036 (15036998417)|SYSTEM_METHOD_ENTRY|[26]|String.valueOf(Object)
15:04:01.037 (15037022793)|SYSTEM_METHOD_EXIT|[26]|String.valueOf(Object)
15:04:01.037 (15037039033)|SYSTEM_METHOD_ENTRY|[26]|System.debug(ANY)
15:04:01.037 (15037044727)|USER_DEBUG|[26]|DEBUG|***** inside rsc IF statement c.id = 500S0000007LWuXIAW ***** <=== c.id has a valid value
15:04:01.037 (15037049435)|SYSTEM_METHOD_EXIT|[26]|System.debug(ANY)
15:04:01.037 (15037108600)|METHOD_EXIT|[15]|01pS000000070OI|HOL_NA_CaseEscalated.processCase(LIST<Case>)  <=== trying to add it to the Set fails
15:04:01.037 (15037198686)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

Class.HOL_NA_CaseEscalated.processCase: line 27, column 1
Trigger.Cases: line 15, column 1
15:04:01.037 (15037221135)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object


 
With zero OOP experience Apex is turning out to be quite a challenge.  

I have the following trigger in the system already and want to call a new method from a new class.  How do I do that?
This is still being built so there's a lot of holes in the class file yet to be filled.  I have attempted to duplicate what is in there passing in either trigger.new or trigger.old but both fail.  It only needs to fire After and Update so I know that it only needs to be in the blcok immediately following the if statement.
trigger Cases on Case (after delete, after insert, after undelete, after update) {

  ClassNameOne cno = new ClassNameOne();
    
  if(Trigger.isAfter && Trigger.isUpdate) {
    cno.linkUpdate(Trigger.new, Trigger.old);
HOL_NA_CaseEscalated.processCase(Trigger.old); // THIS IS WHERE THE ERROR MESSAGE REFERS TO LINE 15
  }
  else if (Trigger.isAfter && Trigger.isDelete) {
    cno.linkUpdate(Trigger.old);
  }
  else if (Trigger.isAfter && Trigger.isInsert) {
    cno.linkUpdate(Trigger.new);  
  }
  else if (Trigger.isAfter && Trigger.isUndelete) {
        cno.linkUpdate(Trigger.new);
  }
}

Here's my Class
public class HOL_NA_CaseEscalated {
    public void processCase(Case[] cs) 
    {
// Create a lists to hold any new Cases to insert or existing Cases to update
		List<Case> newCases = new List<Case>();  // Cases to add  
        List<Case> myUpdates = new List<Case>();   // Cases to update

        // create a map of record types
        Map<string,id> rType = new Map<string,id>();
        for (RecordType rt : [SELECT id, developername FROM RecordType WHERE isactive=TRUE and sobjecttype='Case']){
         	rType.put(rt.DeveloperName, rt.Id);  // add key/value pairs to map so we can lookup ID by name
        }
		id rsc = rType.get('Recycling_Support_Case'); 
        id pdc = rType.get('HOL_NA_Escalated_Case'); 
        System.debug('***** Recycling Support Case is recordtypeid ' + rsc + ' *****'); 
        System.debug('***** Esclated Case is recordtypeid ' + pdc + ' *****'); 
        // Create a collections of ids
        Set<id> RecIds; 
        Set<id> EscIds; 

        for(Case c:cs){
            if(c.RecordTypeId==rsc){
            	RecIds.add(c.id);    // ERROR MESSAGE POINTS TO THIS 
            } 
            if (c.RecordTypeId==pdc){
                EscIds.add(c.id); 
            } 
        }

// List all child cases on the triggering Case
        List<Case> RecChildren = new List<Case>();
        RecChildren=[SELECT id,status, casenumber,parentid,subject, recordtypeid FROM Case WHERE parentid IN:RecIds];
        
        for(Case c:cs){
            if (c.recordtypeid==rsc && c.Escalated_To__c=='Escalated to Development'){ // This is a Recycling Support Case
                // check child cases for the existence of a HOL NA Escalated Case
                if(c.Is_a_Parent_Case__c==true && c.RecordTypeId==pdc){
                	// if one exists, edit it - set Status to Open
                	c.Status='Open';
                    myUpdates.add(c);  // Add to list of Cases to update later.
                } else {
                	// if one does not exist, create it  
					Case newCase = new Case();
                    newCase.RecordTypeId=pdc;
                    newCase.Status='New';
                    newCase.Subject='Escalation: ' + c.Subject;
                    newCase.Case_Name__c=c.Case_Name__c;
                    newCase.AccountId=c.AccountId;
                    newCase.ContactId=c.ContactId;
                    newCase.Case_Phone_Number__c=c.Case_Phone_Number__c;
                    newCase.Business_Impact_Frequency__c=c.Business_Impact_Frequency__c;
                    newCase.Business_Impact_Scope__c=c.Business_Impact_Scope__c;
                    newCase.Severity__c=c.Severity__c;
                    newCase.Priority=c.Priority;
					newCase.Defect_Escalation_Questions__c=c.Defect_Escalation_Questions__c;
                    newCases.add(newCase);
                }
            } else if (c.recordtypeid==pdc){ // This is a HOL NA Escalated Case
                // find the parent Case and update it
                
            } else {
                // do nothing
            }
        }
        
        if(newCases.size() > 0){
                insert newCases;
        }
        
        if(myUpdates.size()>0){
            update myUpdates;
        }
	}
}
And the text of my error message states; 
System.DmlException: Update failed. First exception on row 0 with id 500S0000007LVRdIAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Cases: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Class.HOL_NA_CaseEscalated.processCase: line 22, column 1
Trigger.Cases: line 15, column 1: []


 
Why do I get the error stating "Initial term of field expression must be a concrete SOBject: LIST<Case>?
public class HOL_NA_CaseEscalated {
    public static void processCase(Case[] cs) 
    {
        Map<string,id> rType = new Map<string,id>();
        for (RecordType rt : [SELECT id, developername FROM RecordType WHERE isactive=TRUE and sobjecttype='Case']){
         	rType.put(rt.DeveloperName, rt.Id);  // add key/value pairs to map so we can lookup ID by name
        }
        // List all child cases on the triggering Case
        List<Case> CaseChildren = new List<Case>();
        CaseChildren=[SELECT id,casenumber,parentid,subject FROM Case WHERE parentid=:cs.parentid];  
// ERROR DIRECTS ME TO LINE ABOVE
        
		id rsc = rType.get('Record Type One'); 
        id pdc = rType.get('Record Type Two'); 
            
        for(Case c:cs){
            if (c.recordtypeid==rsc){ // This is a Record Type One Case
 				               
            } else if (c.recordtypeid==pdc){ // This is a Record Type Two Case
                
            } else {
                // do nothing
            }
        }
	}
    
}
The error directs me to the last line above.
 
Since web-to-case will only attempt to validate an email address and then will only accept a single match I need to create a way to match on a custom field, username__c.  This value is captured on the web-to-case form and is also present on the Contact object.  Here's what I have so far but the compiler is yelling at me for using Case instead of sObject.  If I use sObject instead of Case I cannot directly stipulate the field I want to match.  Where have I gone wrong?
 
public class CaseAssociationByUserId {

    public void AssociateCases(Case[] cases){
        // get ids of incoming cases
        Set<String> userids = new Set<String>();
        Map<String,Id> CaseMap = new Map<String, Id>();
        // loop through Cases and create map and array of usernames
        for(Case c : Trigger.new){
            userids.add(c.Username__c);
            CaseMap.put(c.Username__c, c.Id); 
        }
        List<Contact> con = [SELECT id, username__c FROM Contact WHERE username__c IN : userids];
        Map<String, Id> ContactMap = new Map<String, Id>();
        // create map of contact usernames to ids
        for(Contact co : con){
            ContactMap.put(co.username__c, co.id);
        }
        List<Case> toUpdate = new List<Case>();
        // loop through cases again and populate the contact for Cases where the Contact is blank
        for(Case c : Trigger.new){
            if(c.ContactId==null || c.ContactId==''){
            	// find the username and add to the toUpdate list
            	c.contactid=ContactMap.get(c.Username__c);
        	}
        }
        update toUpdate;
    }
}

 
Salesforce1 Mobile basics unit 5/5 - Creating Object-Specific Publisher Actions

I believe I have follwed the requirements explicitly, three times now.  Validated that the publisher action actually does what it's supposed to but the check from Trailhead returns an error.  
"Challenge not yet complete... here's what's wrong: 
There was an unhandled exception. Error: NoMethodError. Message: undefined method `each' for nil:NilClass"
Error message

I have deactivated all Account triggers to insure there's not a conflict.
I have zero data validation rules on the Account object.
I have zero workflow rules on the Account object.
I have checked that all Approvals are deactivated.

Here are all of the components...

Action
Update Account Information action
Publisher Layout
Account Detail publisher layout
Page Layout
Account Layout

Functional Results
Update Results


I'm quite anxious to complete this unit as it's the only one I have left.
Getting an error message stating, "Challenge not yet complete... here's what's wrong: 
You do not have the correct account fields in the 'Update Account Information' publisher action"

However, the challenge specifically states that the new action be titled "New Detailed Account".
Thinking it may be a typo I renamed my action, still failed but stated that the "New Detailed Account" action didn't exist.
Next I changed the name back to the correct name referenced in the challenge and created a new one with the name mentioned in the error, but there's no way to tell what the actual fields within that action should be so it still fails.  Has anyone else experienced this?
I'm flustered, can't understand why this won't work...  help please.

Here's my code, it works fine like this but I want to add an update to the event survey_sent__c field so that once the email is successfully sent the flag on the event that triggered this action is updated.  I want to do this to eliminate the recursive trigger.  Also, when the survey is actually completed the event gets updated again and I want to insure another message isn't sent.

public with sharing class SurveyEmail {
//
// this is called from a before update trigger by SurveyEmail.checkEvents(Trigger.new);
// 
    public void checkEvents(Event[] ev){

        List<Id>EventMembers = new List<Id>();
        Map<Id,Id> EventMap = new Map<Id, Id>();

        If (ev!=null){
            For (Event e:ev){
                if(e.Send_Survey__c==true && e.Event_Status__c=='Completed' && e.survey_sent__c==false){  // if e.survey_sent__c is true then abort
                    System.debug('#####  Survey box checked, processing Event with ID = ' + e.id);
                    If(e.WhoId != null){
                        EventMembers.add(e.WhoId);
                        EventMap.put(e.whoid, e.id);
e.survey_sent__c = true;    // tried this with the update statement at the end and it won't work - also tried creating a 2nd list and updating that, also fails
                    }
                }
            }
        }
If(EventMembers.size()>0){
            string EmailFailure=null;
    // generate list of contacts to send message to  
            System.debug('##### Creating List of Contacts to send message too... '); 
            List<Contact>myRecipients = [SELECT id, firstname, lastname, email FROM contact WHERE id IN :EventMembers AND (NOT email LIKE '%forbidden%') ];
   
    // create email objects as a list
            System.debug('#####  Creating list of messages ...');
            List<Messaging.SingleEmailMessage> allMsg = new List<Messaging.SingleEmailMessage>();
            OrgWideEmailAddress owa = [SELECT id, DisplayName, Address FROM OrgWideEmailAddress WHERE DisplayName='Global Sender' LIMIT 1];
            // append new message to above list for each Contact
            For (Contact c:myRecipients){
                Id EvId = EventMap.get(c.id);
                String theMsg = ('Please click the link below, or copy and paste into your browser to complete a brief survey ');
                theMsg = theMsg + ('related to your recent interaction with an awesome service representative. \n \n ');
                theMsg = theMsg + ('http://www.thethirdparty.com/survey?iv=############&q1=' + EvId + '&q2=' + c.id);
                                   
                System.debug('#####  Creating an instance of the message ...');
                try{
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    mail.setSenderDisplayname(owa.DisplayName);
                    mail.setReplyTo(owa.Address);
                    mail.setTargetObjectId(c.id);
                    mail.setUseSignature(false);
                    mail.setSubject('Please complete this survey from the company.');
                    mail.setPlainTextBody(theMsg);
                    mail.setSaveAsActivity(true);
                    System.debug('#####  Sending message ...');
                    Messaging.SendEmailResult[] mailResult=Messaging.sendemail(new Messaging.SingleEmailMessage[]{mail});
                    Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
                   
               
                    if (!mailResult[0].isSuccess() ){
                        EmailFailure = 'Email Failed: ' + mailResult[0].getErrors()[0].getMessage();
                    }
                }
                catch(Exception Exp){
                    EmailFailure='Exception: ' + Exp.getCause();
                }
            }
        }
    }
}
If I have some code that I would like to submit for the sforce Excel connector where should I send it?  Often I need to look up accounts in specific 3 digit zip areas (starting with xxx) and the current version only has a LIKE %var% function.  I've added a 'starting with' selection that creates a query of LIKE var% and tested it pretty thouroughly.
Product is a standard lookup field on the Case object yet a soql query doesn't see it.  I'm an admin.  I have full rights to the object & field.  The field is on a page layout.  Why isn't it available to query?  I also noticed a describe call doesn't return the field either.
 
SELECT ID, Product FROM Case WHERE ID='500L000000DTFao'
           ^
ERROR at Row:1:Column:12
No such column 'Product' on entity 'Case'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.


 
Here's my code, page, extension & test.  No coverage for the entire list of attachments.
Extension:
public class CaseListController {
    
    private final Case cas; 
    private String sortOrder = 'CreatedDate'; 
    public Case cCas;
    public Case pCas; 
    public Id theParent;
    
    public CaseListController(ApexPages.StandardController stdController) {
        this.cas = (Case)stdController.getRecord();
        cCas=[SELECT id, parentid, casenumber FROM case WHERE id=:cas.id];
        pCas=[SELECT id FROM case WHERE id=:cCas.ParentId]; 
        theParent=pCas.id;
        System.debug('The Parent Record is: ' + theParent); 
    }
    
    public List<Attachment> getAttachments() {
        List<Attachment> results; 
        If(theParent != null){
            results = Database.query(
                'SELECT Id, parentid, parent.name, name, CreatedDate, ContentType, ownerid ' + 
                'FROM Attachment ' + 
                ' WHERE parentid =:theParent ' + 
                'ORDER BY ' + sortOrder + ' DESC ' + 
                'LIMIT 10'
            ); 
        } 
        return results;
    }
}
Page: 
<apex:page standardcontroller="Case" extensions="CaseListController" sidebar="false" showHeader="false" >
    <apex:form >
        <apex:pageBlock title="Parent Attachments" id="attachments_list"> 
            <apex:pageBlockTable value="{! attachments }" var="at">
                <apex:column headervalue="File">
                    <apex:outputLink value="/servlet/servlet.FileDownload?file={! at.id}" target="_blank">{! at.Name}
                    </apex:outputLink>
                </apex:column>
                <apex:column value="{! at.contenttype }"/>
                <apex:column value="{! at.createddate }"/>
                <apex:column value="{! at.ownerid }"/>
                <apex:column value="{! at.parent.name }" headerValue="Case"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Test:  
@isTest
public class CaseListController_Test {

    public static testMethod void testMyController() {
        Account testAccount = new Account();
		testAccount.Name='Test Account'; 
        testAccount.Phone='(999) 999-9999';
        
        Case ParentCase = new Case();
        ParentCase.AccountId = testAccount.id; 
        ParentCase.RecordTypeId='012L000000073y2';
        ParentCase.Reason__c='Move User';
        ParentCase.Subject = 'Test Parent Case'; 
        ParentCase.Description = 'Test Parent Case'; 
        insert ParentCase; 
        
        Case ChildCase = new Case();
        ChildCase.AccountId = testAccount.id; 
        ChildCase.ParentId = ParentCase.id;
        ChildCase.RecordTypeId='012L000000073y2';
        ChildCase.Reason__c='Move User';
        ChildCase.Subject = 'Test Parent Case'; 
        ChildCase.Description = 'Test Parent Case'; 
        insert ChildCase; 
        
        Attachment atch = new Attachment();
        Blob bodyBlb=Blob.valueOf('test body');
        atch.Name='test attachment'; 
        atch.parentid=ParentCase.Id; 
        atch.Body=bodyBlb;
        insert atch;
        
        Test.startTest();
        PageReference pageRef = Page.ParentCaseAttachments;
        pageRef.getParameters().put('Id',ChildCase.Id);
        Test.setCurrentPage(pageRef);
        
        ApexPages.StandardController sc = new ApexPages.StandardController(ChildCase);
        CaseListController ext = new CaseListController(sc);
        Test.stopTest();
    }
}

Any direction is appreciated!
  • September 11, 2018
  • Like
  • 0
Hello gurus,
I'm trying to be a better developer by writing the test code first.  I can't create all the needed test objects.  Account, Contact, Case are created and I can see the IDs in the debug log but get an error when creating the Asset.  What am I overlooking?

There is no other code created yet.
 
@IsTest(SeeAllData=True)

public class AssetUpdateTest {
    
    public static testmethod void testAssetLink()    {
        Account acc = createAccount(); 
        Contact con = createContact(acc); 
        Case cas = createCase(acc,con); 
        Asset ast = createAsset(acc,con,cas); 

        System.debug('**************************   Case ID: ' + cas.id); 
        System.debug('**************************   Case.Asset: ' + cas.AssetId);
        
    }
    
    public static Account createAccount(){
        Account theAccount = new Account(
            recordtypeid='01270000000Q7rQ', 
            name='Test Account', 
            Status__c='Client',
            Line_of_Business__c='CRS',
            phone='8005551212', 
            currencyisocode='USD'); 
        
        insert theAccount;
        return theAccount; 
    }    
    
    public static Contact createContact(Account theAccount){
        Contact theContact = new Contact(
            recordtypeid='01270000000Q7ra',
            email='tim.bouscal@audatex.com', 
            firstname='George', 
            lastname='Washington',
            accountid=theAccount.id);
        insert theContact;        
        return theContact; 
    }
    
    public static Case createCase(Account acc, Contact con){
        Case theCase = new Case(
            recordtypeid='01270000000Dy9u', 
            AccountId = acc.Id, 
            ContactId = con.Id,             
            
            Requestor__c=con.Id, 
            Reason='New Account Setup', 
            Reason_Detail__c='New - ADXE Shop 02',
            Status='New', 
            Origin='Sales Request', 
            Subject='AssetUpdateTest Sample BisOps Case', 
            Description='This is a sample case for testig the AssetUpdate class'
        ); 
        insert theCase; 
        return theCase;
    }    
    
    public static Asset createAsset(Account acc, Contact con, Case cas){
        System.debug('***** ***** ***** Account ID: ' + acc.id + '     Contact Id: ' + con.id + '     Case ID: '+ cas.Id); // all 3 values show in debug log
        Asset theAsset = new Asset(
            Name='Test Asset', 
            Account = acc, 
            Contact = con, 
            Case_Number__c = cas.CaseNumber, 
            Type__c='New', 
            Status='Purchased', 
            Description='This is a test asset for testing the AssetUpdate class'
        );
        insert theAsset; 
        return theAsset; 
    }
}

Error: 
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Every asset needs an account, a contact, or both.: [AccountId, ContactId]

Class.AssetUpdateTest.createAsset: line 69, column 1
Class.AssetUpdateTest.testAssetLink: line 9, column 1

 
Hi All,
These are my Controller and my Test Class.
Whatever I change I could not reach more than 50% coverage.
Could you please help me to get at least 75% to deploy in Production?
public class MyCPDPointsAPEXController {
    
@AuraEnabled    
    public CPD_Points_Total__c total {get;set;}
    string recordId = ApexPages.currentPage().getParameters().get('recordId');
    
    public MyCPDPointsAPEXController(ApexPages.StandardController controller) { 
        
        total = [select Id, Name, Total_Points__c, (select Id, Activity_Date__c, Activity_Title__c, Organiser_Company__c, Points__c from CPD_Register__r) from CPD_Points_Total__c where Id=:ApexPages.currentPage().getParameters().get('recordId')];
    }
    
    public PageReference cancel(){   
        return new PageReference('/' + recordId);   
    }
}
 
@isTest
private class MyCPDPointsAPEXTest {
    
    static testMethod void MyTest()
    {
        CPD_Points_Total__c total = new CPD_Points_Total__c(Name='Test-2017');  
        
        ApexPages.CurrentPage().getparameters().put('id', total.id);      
        
        Apexpages.StandardController sc = new Apexpages.StandardController(total);
        MyCPDPointsAPEXController ext = new MyCPDPointsAPEXController(sc); 
        
        ext.cancel();      
    }
}



Thank you in advance for your help.
Sylvie
 
HI! I am working on this formula below and receiving this error:  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 4

I have tried everything that I could to change this. please help

IF(
IF(
DATEVALUE(CreatedDate)  < DATEVALUE("2017-04-10"),
REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  REVVY__Extended_Price_Display_F__c + REVVY__One_Time_Extended_Price_S__c)))),
IF(
REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  REVVY__Extended_Price_Display_F__c  )))))
I was advised that Winter '17 has a customer self-scheduling component for the Field Service Lightning package.  I cannot find any documentation on how to set this component up in the Community.  Plenty of docs on Communities and configuring but nothing specific to client self-scheduling.
Any pointers?
Hello All,
    I have created a VF tab and attached a VF page to this custom VF tab. The VF page has Account as the Standard Controller. So now, as shown in the below attached screenshot, when the user clicks on the MyRelationships VF tab, the VF page should open in a new tab and it should not affect the current tab, I mean the current tab should remain in the same contacts tab. Is this  feasible? If so, please let me know.User-added image

Thank You for your time.
Hi All,

I want to use "Salesforce for outlook". I downloaded the setup file from my Salesforce org and installed in my laptop. While, I'm doing the sync with Outlook 2010 with Salesforce, I can't able to sync my objects. I'm getting an error message, saying "IT'S NEED TO CONNECTED WITH MICROSOFT EXCHANGE SERVER". What i'm missing here, I have enclosed the below error image. Thanks in advance!

User-added image
Not sure what's going on, the parent cases get insert but the child cases do not.
 
List <Case> lCase = new List<Case>();
        List <Case> nCase = new List<Case>();
        for(integer i=0; i<20; i++){
        	Case cas1 = new Case(
                recordtypeid=rsc,
                accountid=acc1.id,
                contactid=con1.id,
                Case_Name__c='John Doe',
                case_phone_number__c='(800) 555-1212', 
                subject='Test Recycling Case',
                origin = 'Phone',
                status='Escalated to Management',
                Escalated_To__c='Return to Liaison',
                description='This is a parent Case');
           if(math.mod(i,2)==0){
                cas1.Case_Phone_Number__c='(800) 555-1212';
            }
			lCase.add(cas1);
        
            Case cas2 = new Case(
                recordtypeid=pdc,
                parentid=cas1.id,
                accountid=acc1.id,
                contactid=con1.id,
                status='Closed',
                Case_Name__c='John Doe',
                case_phone_number__c='(800) 555-1212', 
                subject='Escalation: Test Recycling Case',
                description='This is an escalated Case');
                nCase.add(cas2);
        }

I've also tried adding the children cases to the same list as the parents and inserting them all at once, which works, but doesn't hold the link to the parent.  They're all standalone cases.
 
Need some help understanding when to use before or after triggers and new or old.  Spefically I have the following issue;
When a Case is Escalated I want to create a child Case of a different record type but only if one doesn't already exist.  this works.
* If the child Case already exists I want to update it's status (from Closed to Open).  * System.FinalException: Record is read-only:
When the child Case is closed I want to update the Parent. this works
Also, when the Child is Closed I want to update the Parent. this works.

I have the code to do all of that but I get read only errors trying to update the Child.  I have tried with many combinations of before/after new/old
Hello Experts,

We have a problem related to a process which we are trying to map to salesforce, scrapping spread-sheets.

Scenario

We are an event organisers and run events all over world (various segments), people opt to come in to the event, some people show interests and sometimes multiple people come to attend event from same company. Currently a team of people enter the name of the attendee's manually in salesforce as contacts and then attached to an opportunity.

Problem

We have adopted a method of web-to-lead to capture information directly to Salesforce and that is working well (though we want web-to-contact) but as of now we can live with web-to-lead. The real challenge is how we can capture multiple leads/contact through a web page into Salesforce.

For Example:

if 4 people coming to an event from same company and trying to register through web-site then how we can prompt them to fill four forms so that we capture four different leads/contacts rather than just one record?


if anyone can give us any sort of guidence then we can overcome this problem.

any response is highly appreciated

Regards,

Ankur

Hi friends,

 

I have list of records,when i click the particular records it display the details of records.some records not display it's loading too long time after that am getting err like this.. Apex CPU time limit exceeded and An unexpected error has occurred. Your development organization has been notifiedwhy this err occur how to resolve this please can anyone help me..thanks in advance..

 

Regards,

kathir

The use case is that customer is presented with a VF page to book a resource (typically a consultant) for number of hours on a particular date. Once customer selects a specific resource her/his availability calendar appears where start and end time can be selected to make a booking.

thanks