• JJSHHS
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 17
    Replies
I understand that you could pass collection of Sobjects to Queueable apex classes but not to future methods where we're restricted to only primitive collections. The reason it's not done for future methods is that the objects could potentially change from the time it's passed to the time when the future method executes.

Question - Will this hypothesis not hold true for Queueable apex and even batch apex for that matter (record value/criteria could change from when it's executed by the start method to when it's processed by the execute method when processing large sets of batches -- unless you completely take the sf org down for maitenance, in which case, this shouldn't be an issue for both queuable and batch apex) - Is that an expectation for both Queueable and Batch apex? or are there any alternatives?

Just wanted to get the group's thoughts on this one.
  • March 03, 2016
  • Like
  • 0
Hello,

I have a question. In the challenge, we're asked to create the 'getAnimalNameById' method that accepts an Integer and returns a String.
The AnimalLocatorMock is NOT returning a string, instead it's returning a HTTPResponse. So, when I actually try to make the callout in the Test Method, I'm getting an error (Illegal assignment from String to System.HttpResponse).

I could change my 'getAnimalNameByID' method to return a HTTPResponse instead of a String. But, is this the correct way or am I missing something? I've pasted the code snippets below.
 
@isTest
global class AnimalLocatorMock implements HttpCalloutMock {
    
    global HttpResponse respond(HTTPRequest request){
      //create a fake response
      HTTPResponse response = new HTTPResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}');
        response.setStatusCode(200);
        return response;
    }

}
 
@isTest
public class AnimalLocatorTest {
    @isTest static void testGet(){
        //set the mockout class
        Test.setMock(HTTPCalloutMock.class, new AnimalLocatorMock());
        //Do the callout here
        HTTPResponse response = AnimalLocator.getAnimalNameById(1);
    }

}

 
  • February 23, 2016
  • Like
  • 0
Hi, I was wondering if I could download the trails as PDF and can print it - like the workbooks, likewise for the trailhead modules, can I download and print them?

Didn't see a option for doing so and thought shall ask - since it's very difficult to be starting at a screen at all time.

Please advise.
  • December 19, 2015
  • Like
  • 0
Hi, I have a couple of questions..

1) I have a validation rule setup on the Phone field of the Acct object - that it should be it at least 10 digits. When I'm using a custom controller and have multiple pages to navigate (the second page is to collect contact info), the validation rule isn't fired till I tried to save at the end of the wizard. Is there anyway to fire validation rules before I move to the next page?

2) On the second page, I'm trying to add multiple contacts for a single acct. How do I enforce that I should not be allowed to add more than 5 contacts for a given time. Should I use Javascript or is there way in VF, I can accomplish this...

Please advise.
 
Hello,

I'm trying to seek some help with the following VF page and the controller behind it, Basically, the outline of this controller is 3 pages...page 1 to capture account info, page 2 to capture multiple contacts for this acct and page 3 to just show the confirmation page....and give users the option to delete the contacts one by one by with a command button.

Now, neither the OnClick action is working, nor is the method getting invoked (I'm unable to see the "inside deleteCont" message in the debug logs) and the re-rerender is not working too...Please advise on what is it I'm missing.

 

    	
    	
        
            
            
                
            	
            	
                
                
                
 					
                    
                    
            
            
            
            
            	
                
                
                
                
 					
                        
                    
                    
				 
            
                                 
            
            
    
public class newOpportunityController {

   public Account acct {get;set;}
   public contact cont {get;set;}
   public Listcontactstoadd{get;set;}
   private static final integer maxContacts=5;
   public Integer rowIndex {get;set;}
   public pagereference page3;

public newOpportunityController() {
      if(acct == null) 
          {acct = new Account();}
      if(cont == null)
          {cont = new Contact();}
       if (contactstoadd == null) 
          {contactstoadd = new list();}
           
   }
public pagereference deleteCont() {
       system.debug('inside deleteCont');
       
       rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
         System.debug('row to be deleted ' + rowIndex );
         System.debug('rowm to be deleted '+Contactstoadd[rowIndex]);
        contactstoadd.remove(rowIndex);
       return page3;
     
 
 }
​}

 
Hi,

What are some of the search functionalities with searching this board. Also, in addition to my own questions, can I choose to follow certain users when they post questions. How do I do it?

Also, some time earlier this month, there was a question posted about triggers. I remember the "partial" name of the user, how do I search for it and get the questions posted by that person? I believe his user name started with "chicken..." or 

Pl advise.
  • February 24, 2014
  • Like
  • 0
Hello,

I have several basic questions pertaining to Workflows and approvals after reading Chapter 9 on Fundamentals books.

1. I have a new user created under my existing DE org. When I open up a second browser instance and wanted to switch back and forth, it "automatically" changes to the other user. I don't know why / how it got changed. From a given "user instance" on the screen, how do I change to the "other user instance" without having to log out and log in. If I have to multi-user approval/WF scenarios, how do I do with a single DE org?

2.  The first time I setup the approval process, I got an option to add the "approval related list" on the object on which I'm setting up the approval process. However, when I tried to do that subsequently, I never see that option, why?

3. Under time dependent WF actions, it states in the book that they are actions that occur before a certain amount of time has elapsed  - example given was seven days before the value of the hire by field. I didn't quite understand this example. In my mind, actions happen only a rule critieria has been "met", so an action can always "happen" after the fact. Can someone help explain?

4. In the book, it states when you accept positions from "unclaimed positions queue", it automatically removes those entries from under the "Time Based Workflow Menu" which you can access from the setup page. In my case, the records are still showing up even though I accept them. Not sure what am I missing here.

5. How to debug a WF rule line by line using the developer console? Can you do that for WF rules completely built using the platform? Pl share an example on how to do that.

6. On the approval process, when you choose "Next automated approved determined by"  - when you choose "Manager field", I have a few questions.

Let's say, I'm a recruiter, R1 and my Manager is RM1

The hiring mgr for the position is HM1 and his supervisor is HM2

As a recruiter, when I submit a position for approval, if this option is chosen, then would the position record go RM1 for approval, since he is the manager for R1 vs. the record going to HM1 for first level of approval and then to HM2 for the final approval (in a 2 step approval process). In this case, should I chose "create hierarchial relationship of R1 -> HM1 -> HM2), is this correct?

Thanks for your help !
  • February 24, 2014
  • Like
  • 0
Hello,

If I were to build an app, and I only the DE to do it. Is there any I can "expose this app" -- it could simply be a static "web portal" to other users on the intrenet and can they access it like how they would access a regular website without having to create a DE login.

Please suggest.

Thank you.
  • February 14, 2014
  • Like
  • 0
Hello,

Had this dumb question. I can hear you telling that this can be done by setting up default values on the platform itself vs. a trigger and I'm completely trying the below as an experiment.


trigger spnInsert on Position__c (before Insert) {

    For (Position p: trigger.new) {
   
        p.Max_Pay__c = 99999;
    }
}


I'm getting this error below.

Error: Compile Error: Invalid type: Position at line 3 column 10

When I tried changing the for loop to state, however, I'm getting a different error - trigger name is already used

For (Position__c p: trigger.new) {

3. I also tried the below one.

trigger spnInsert on Position__c (before Insert) {

    list <position__c> p = new list <position__c>();

    For (p : trigger.new) {
   
        p.Max_Pay__c = 99999;
    }
}

Pl advise, what am I missing here.
  • February 10, 2014
  • Like
  • 0
Hello,

I have a question. In the challenge, we're asked to create the 'getAnimalNameById' method that accepts an Integer and returns a String.
The AnimalLocatorMock is NOT returning a string, instead it's returning a HTTPResponse. So, when I actually try to make the callout in the Test Method, I'm getting an error (Illegal assignment from String to System.HttpResponse).

I could change my 'getAnimalNameByID' method to return a HTTPResponse instead of a String. But, is this the correct way or am I missing something? I've pasted the code snippets below.
 
@isTest
global class AnimalLocatorMock implements HttpCalloutMock {
    
    global HttpResponse respond(HTTPRequest request){
      //create a fake response
      HTTPResponse response = new HTTPResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}');
        response.setStatusCode(200);
        return response;
    }

}
 
@isTest
public class AnimalLocatorTest {
    @isTest static void testGet(){
        //set the mockout class
        Test.setMock(HTTPCalloutMock.class, new AnimalLocatorMock());
        //Do the callout here
        HTTPResponse response = AnimalLocator.getAnimalNameById(1);
    }

}

 
  • February 23, 2016
  • Like
  • 0
Hi, I have a couple of questions..

1) I have a validation rule setup on the Phone field of the Acct object - that it should be it at least 10 digits. When I'm using a custom controller and have multiple pages to navigate (the second page is to collect contact info), the validation rule isn't fired till I tried to save at the end of the wizard. Is there anyway to fire validation rules before I move to the next page?

2) On the second page, I'm trying to add multiple contacts for a single acct. How do I enforce that I should not be allowed to add more than 5 contacts for a given time. Should I use Javascript or is there way in VF, I can accomplish this...

Please advise.
 
Hello,

I'm trying to seek some help with the following VF page and the controller behind it, Basically, the outline of this controller is 3 pages...page 1 to capture account info, page 2 to capture multiple contacts for this acct and page 3 to just show the confirmation page....and give users the option to delete the contacts one by one by with a command button.

Now, neither the OnClick action is working, nor is the method getting invoked (I'm unable to see the "inside deleteCont" message in the debug logs) and the re-rerender is not working too...Please advise on what is it I'm missing.

 

    	
    	
        
            
            
                
            	
            	
                
                
                
 					
                    
                    
            
            
            
            
            	
                
                
                
                
 					
                        
                    
                    
				 
            
                                 
            
            
    
public class newOpportunityController {

   public Account acct {get;set;}
   public contact cont {get;set;}
   public Listcontactstoadd{get;set;}
   private static final integer maxContacts=5;
   public Integer rowIndex {get;set;}
   public pagereference page3;

public newOpportunityController() {
      if(acct == null) 
          {acct = new Account();}
      if(cont == null)
          {cont = new Contact();}
       if (contactstoadd == null) 
          {contactstoadd = new list();}
           
   }
public pagereference deleteCont() {
       system.debug('inside deleteCont');
       
       rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
         System.debug('row to be deleted ' + rowIndex );
         System.debug('rowm to be deleted '+Contactstoadd[rowIndex]);
        contactstoadd.remove(rowIndex);
       return page3;
     
 
 }
​}

 
Hi,

What are some of the search functionalities with searching this board. Also, in addition to my own questions, can I choose to follow certain users when they post questions. How do I do it?

Also, some time earlier this month, there was a question posted about triggers. I remember the "partial" name of the user, how do I search for it and get the questions posted by that person? I believe his user name started with "chicken..." or 

Pl advise.
  • February 24, 2014
  • Like
  • 0
Hello,

I have several basic questions pertaining to Workflows and approvals after reading Chapter 9 on Fundamentals books.

1. I have a new user created under my existing DE org. When I open up a second browser instance and wanted to switch back and forth, it "automatically" changes to the other user. I don't know why / how it got changed. From a given "user instance" on the screen, how do I change to the "other user instance" without having to log out and log in. If I have to multi-user approval/WF scenarios, how do I do with a single DE org?

2.  The first time I setup the approval process, I got an option to add the "approval related list" on the object on which I'm setting up the approval process. However, when I tried to do that subsequently, I never see that option, why?

3. Under time dependent WF actions, it states in the book that they are actions that occur before a certain amount of time has elapsed  - example given was seven days before the value of the hire by field. I didn't quite understand this example. In my mind, actions happen only a rule critieria has been "met", so an action can always "happen" after the fact. Can someone help explain?

4. In the book, it states when you accept positions from "unclaimed positions queue", it automatically removes those entries from under the "Time Based Workflow Menu" which you can access from the setup page. In my case, the records are still showing up even though I accept them. Not sure what am I missing here.

5. How to debug a WF rule line by line using the developer console? Can you do that for WF rules completely built using the platform? Pl share an example on how to do that.

6. On the approval process, when you choose "Next automated approved determined by"  - when you choose "Manager field", I have a few questions.

Let's say, I'm a recruiter, R1 and my Manager is RM1

The hiring mgr for the position is HM1 and his supervisor is HM2

As a recruiter, when I submit a position for approval, if this option is chosen, then would the position record go RM1 for approval, since he is the manager for R1 vs. the record going to HM1 for first level of approval and then to HM2 for the final approval (in a 2 step approval process). In this case, should I chose "create hierarchial relationship of R1 -> HM1 -> HM2), is this correct?

Thanks for your help !
  • February 24, 2014
  • Like
  • 0
Hello All

I have a requirement of taking a csv and uploading records into a object, no validations required. Just parsing the csv and inserting records.
 Could anyone point me to any blog/website where I can find this stuff. Any help is appreciated.
Hello,

Had this dumb question. I can hear you telling that this can be done by setting up default values on the platform itself vs. a trigger and I'm completely trying the below as an experiment.


trigger spnInsert on Position__c (before Insert) {

    For (Position p: trigger.new) {
   
        p.Max_Pay__c = 99999;
    }
}


I'm getting this error below.

Error: Compile Error: Invalid type: Position at line 3 column 10

When I tried changing the for loop to state, however, I'm getting a different error - trigger name is already used

For (Position__c p: trigger.new) {

3. I also tried the below one.

trigger spnInsert on Position__c (before Insert) {

    list <position__c> p = new list <position__c>();

    For (p : trigger.new) {
   
        p.Max_Pay__c = 99999;
    }
}

Pl advise, what am I missing here.
  • February 10, 2014
  • Like
  • 0