+ Start a Discussion
Aarush SharmaAarush Sharma 
Create object : Candidate__c
Fields : (All Text fields)
First Name
Last Name
Email
Brokerage
Manage Brokerage
Candidate Status (Webinar - Attended , Webinar -Not Attended)
User Created ( checkbox)


On insert:
1. Create Account if Brokerage !=null
2. Create another account if Manage Brokerage != null and set parentId = Brokerage account id (created in 1 point)
3. Create new contact record and set accountId = Manage Brokerage account id (created in 2 point)
   create new field candidate__c(lookup) on contact and fill it with Condidate__c record id
4. Create task record for contact record (created in point 3)
Task.WhoId = contactId
Task.WhatId = Candidate__c
Task.Subject = 'Portal Contact Setup';
 
Best Answer chosen by Aarush Sharma
Akshay_DhimanAkshay_Dhiman
Hi Aarush,

Just Try this one out,
There is one line commented in Task creation of whatId, That should Non - commented only when the 
Candidate object is the child object of Account.
 
trigger TriggerCandidate on Candidate__c (after insert) {
    Map<Id ,Contact> ConListMap = new Map<Id ,Contact>();
    Map<Id ,Account> BroConList = new Map<Id ,Account>();
    Map<Id ,Account> mapBroConList = new Map<Id ,Account>();
    Map<Id ,Task> TaskConList = new Map<Id ,Task>();
    
    List<Account> ManageBroacclist = new List<Account>();
    
    for(Candidate__c con : trigger.New)
    {
        if(con.Brokerage__c!=Null && con.Manage_Brokerage__c!=Null)
        {
            Account Brokerageacc = new  Account();
            Brokerageacc.Name = 'Brokerage Acc';
            if(!BroConList.containsKey(con.Id))
            {
                BroConList.put(con.Id, Brokerageacc);
            }
        }
    }
    if(BroConList.values().size()>0)
    {
        insert BroConList.values();
    }
    for(Candidate__c cont : trigger.New)
    {
        if(cont.Brokerage__c!=Null && cont.Manage_Brokerage__c!=Null)
        {
            Account ManageBrokerageAcc = new Account();
            ManageBrokerageAcc.Name = 'Manage Brokerage Account';
             System.debug('BroconList.get(cont.id).Id---->>>>' + BroconList.get(cont.id).Id);
            if(BroconList.containsKey(cont.id)){
                System.debug('BroconList.get(cont.id).Id---->>>>' + BroconList.get(cont.id).Id);
                ManageBrokerageAcc.ParentId = BroconList.get(cont.id).Id;
            }
            
            if(!mapBroconList.containsKey(cont.id))
            {
                mapBroconList.put(cont.id, ManageBrokerageAcc);
            }
            
            contact contactnew = new contact();
            contactnew.LastName = 'Test cont';
            contactnew.Candidate__c = cont.Id;
            if(!conListMap.containsKey(cont.Id)) 
            {
                conListMap.put(cont.Id, contactnew);  
            }
        }
    }
    if(mapBroConList.values().size()>0)
    {
        insert mapBroConList.values();
    }
    if(ConListMap.values().size()>0)
    {
        insert ConListMap.values();
    }
    
    for(Candidate__c cont3 : trigger.New)
    {
        if(cont3.Brokerage__c!=Null && cont3.Manage_Brokerage__c!=Null)
        {
            Task tt = new Task();
            
            if(conListMap.containsKey(cont3.Id)) 
            {
                tt.WhoId = conListMap.get(cont3.Id).Id;
            }
            
           // tt.WhatId = cont3.Id;
            tt.Subject =  'Portal Contact Setup';
            
            if(!TaskConList.containsKey(cont3.id))
            {
                TaskConList.put(cont3.id , tt);
            }
        }
    }
    if(TaskConList.values().size()>0)
    {
        insert TaskConList.values();
    }
    
}


Thanks 
Akshay
Bms270Bms270 

Hi,

 

When our app makes a callout to an external webservice over SSL, we get the following Exception:

 

System.CalloutException: IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

 This doesn't happen with regular http callout. our certificate is NOT expired on the target server and everything seems to be normal. no alert or anything from the browser.

 any idea?

 

Thanks,

 

P.S We need to resolve this for security review.

 

 

 

 

 

 

Message Edited by Bms270 on 05-14-2009 07:17 PM
Message Edited by Bms270 on 05-14-2009 07:19 PM
Best Answer chosen by Admin (Salesforce Developers) 
Bms270Bms270

My problem solved! there are two things to check,

 

1. check to make sure you have imported your certificate to your java keystore.

 

2. check to make sure you have all your certificate bundle files installed in your apache webserver.

 

there is a java class "SSLPoke.class" which you can download here:

 

 

(class) http://confluence.atlassian.com/download/attachments/180292346/SSLPoke.class?version=1&modificationDate=1236556489366

 

(src)    http://confluence.atlassian.com/download/attachments/180292346/SSLPoke.java?version=1&modificationDate=1236556497004

 

and here's how to use it:

java SSLPoke localhost 443

 

It simply connects to a SSL service, sends a byte of input, and watches the output. For instance, connecting to a local HTTPS server on port 443 (the HTTPS default) with a untrusted (self-signed) certificate.

 

if you get "successfully connected" then you are good, otherwise you need to check the above items I mentioned.

 

for more information please see the link below:

 

http://confluence.atlassian.com/display/CONFKB/Unable+to+Connect+to+SSL+Services+due+to+PKIX+Path+Building+Failed+sun.security.provider.certpath.SunCertPathBuilderException

 

Thanks,

 

priya sonupriya sonu 
can anybody explain with a example where this scenario is used  in a simple manner,  i have gone through differnt examples , bt iam unable to understand it >>ApexPages.currentPage().getParameters().get('recordId') 
Best Answer chosen by priya sonu
Prema -Prema -
Hello Priya,

Suppose you want to get the ID of the current record detail page and you want to show it on your VF page once you click on the button then you can use ApexPages.currentPage().getParamaters().get('id'); It will get the id of that objects record. You can also get the name instead of id like 
public Opportunity currentRecord{get; set;}
currentRecord=ApexPages.currentPage().getParamaters().get('name') and if you want to see the value on developer console you can use System.debug(currentRecord);
Please let me know if it helps
Vincenzo DentiVincenzo Denti 
Hi, I'm stuck on step 5 of this superbadge.
I'm getting the following error "Ensure that you simulate a user visiting the product2New page by using the appropriate method in the System Test class."
Both the tests requested are passing.
Reading the logs on the dev console while I'm checking the challenge It adds 2 logs, one successful, and one that fails while is checking the VerifyQuantityOrdered method. 
I have then intentionally made that method wrong, and the message became "Ensure that the verifyQuantityOrdered method properly asserts the difference between the originalProduct and updatedProduct." that it's sensible and correct

I then reverted to the correct version the VerifyQuantityOrdered
 
System.assertEquals(
            originalProduct.Quantity_Ordered__c + qtyOrdered,
            updatedProduct.Quantity_Ordered__c,
            'error on Quantity_Ordered__c update'
            );

and returned the "Ensure that you simulate a user visiting the product2New page by using the appropriate method in the System Test class."
Digging in the successful log it shows that the VerifyQuantityOrdered it's called, and it's passing, but in the second there is an "Expected: 20, Actual: 10" thrown by the VerifyQuantityOrdered.

Now, for the test side, I tried different options
  • execute as "Standard User" 
    Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
    User u1 = new User(Alias = 'standt1',.....,ProfileId = p.Id,TimeZoneSidKey='America/Los_Angeles', UserName='tests@tests.org');
    
            insert u1;
    System.runAs(u1){
  • Invoking the controller extension  
    ApexPages.StandardController stdctrl = new ApexPages.StandardController(new Product2());
                Product2Extension ext = new Product2Extension(stdctrl);
  • invoking the controller directly as class  
    Product2Extension ext = new Product2Extension();
  • Assign the page reference 
    PageReference pageRef2 = new PageReference('/apex/Product2New');
Caoul anyone point me what I'm evidently missing?
Best Answer chosen by Vincenzo Denti
sunnysfdcdevsunnysfdcdev
Check wit below code if it can help you:
 
@isTest 
    static void Product2Extension_UnitTest(){
        PageReference pageRef = Page.Product2New;
        Test.setCurrentPage(pageRef);
        Product2 prod = new Product2(name='Test',isActive=true);        
        ApexPages.StandardController stdcontroller = new ApexPages.StandardController(prod);        
        Product2Extension ext = new Product2Extension(stdcontroller);        
       	System.assertEquals(Constants.DEFAULT_ROWS, ext.productsToInsert.size());
        
        ext.addRows();
        System.assertEquals(Constants.DEFAULT_ROWS * 2, ext.productsToInsert.size());
        
        for (Integer i = 0; i < 5; i++) {
            Product2Extension.ProductWrapper wrapper = ext.productsToInsert[i];
            
            Product2 testProduct = new Product2();
            testProduct.Name = 'Test Product ' + i;
            testProduct.IsActive = true;
            testProduct.Initial_Inventory__c = 20;
            testProduct.Family = Constants.PRODUCT_FAMILY[0].getValue();
            wrapper.productRecord = testProduct;
            
            PricebookEntry testEntry = new PricebookEntry();
            testEntry.IsActive = true;
            testEntry.UnitPrice = 10;
            wrapper.pricebookEntryRecord = testEntry;
        }
        
        Test.startTest();
        ext.save();
        Test.stopTest();
        
        ext.GetFamilyOptions();
        ext.GetInventory();
        List<Product2> createdProducts = [
            SELECT
            	Id
            FROM
           		Product2
        ];
        System.assertEquals(5, createdProducts.size());
    }

 
Wacław SmagaWacław Smaga 
Hi guys
I'm facing an issue with this step.
I'm getting "Ensure that you implement the Queueable interface in the announcementsQueueable class." error, even though class seems to be ok:
/**
 * @name AnnouncementQueueable
 * @description This class posts Chatter Announcements
**/
public class AnnouncementQueueable implements Queueable {

    public List<ConnectApi.AnnouncementInput> toPost;

    //ToDo: Modify this class to implement the Queueable interface and call the postAnnouncements method
    public void execute(QueueableContext qc) {
        PostAnnouncements(toPost);
    }

    /**
     * @name postAnnouncements
     * @description This method is provided for you to facilitate the Super Badge
    **/
    public static void PostAnnouncements(List<ConnectApi.AnnouncementInput> announcements){
        while ( announcements.size() > 0 ){
            if ( Limits.getDMLStatements() < Limits.getLimitDMLStatements() && !test.isRunningTest() ){
                ConnectApi.AnnouncementInput a = announcements.remove(0);
                ConnectApi.Announcements.postAnnouncement('Internal', a);
            } else {
                break;
            }
        }
        if ( announcements.size() > 0 && !test.isRunningTest() ){
            AnnouncementQueueable q = new AnnouncementQueueable();
            q.toPost = announcements;

            //ToDo: Enqueue the above instance of announcementQueueable
            System.enqueueJob(q);
        }
    }

}
What I noticed is that it's AnnouncementQueueable and error states that announcementsQueueable is not queueable. So I created a duplicate of this class with this name, but still no-go.

Any ideas? Anyone passed this?
 
Best Answer chosen by Wacław Smaga
Pablo Gonzalez Alvarez 3Pablo Gonzalez Alvarez 3
I don't have this problem, my class looks the same as mine and it works just fine (I haven't passed the challenge though). Have you tested this by creating an order with the correct quantity and see if the chatter announcement is created? Here's my class for reference, although it looks the same to me
 
/**
 * @name AnnouncementQueueable
 * @description This class posts Chatter Announcements
**/
public class AnnouncementQueueable implements Queueable{
    
    public void execute(QueueableContext context){
        PostAnnouncements(toPost);
    }
    

    public List<ConnectApi.AnnouncementInput> toPost;

    //ToDo: Modify this class to implement the Queueable interface and call the postAnnouncements method


    /**
     * @name postAnnouncements
     * @description This method is provided for you to facilitate the Super Badge
    **/
    public static void PostAnnouncements(List<ConnectApi.AnnouncementInput> announcements){
        while ( announcements.size() > 0 ){
            if ( Limits.getDMLStatements() < Limits.getLimitDMLStatements() && !test.isRunningTest() ){
                ConnectApi.AnnouncementInput a = announcements.remove(0);
                ConnectApi.Announcements.postAnnouncement('Internal', a);
            } else {
                break;
            }
        }
        if ( announcements.size() > 0 && !test.isRunningTest() ){
            AnnouncementQueueable q = new AnnouncementQueueable();
            q.toPost = announcements;
            System.enqueueJob(q);

            //ToDo: Enqueue the above instance of announcementQueueable
        }
    }

}

Have you tried System.Queueable instead? 

On the other hand, I'm getting the following error on the same step

Ensure that you modify the COLLABORATION_GROUP query to use the INVENTORY_ANNOUNCEMENTS constant.

Even though I'm using the constant in the query
 
List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup  WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS LIMIT 1];
            
announcement.parentId = chatterGroups[0].Id;

Very frustrating. Let me know if you get passed this step. 
Kathryn PuzzangheraKathryn Puzzanghera 
Hi, I'm getting the error message: There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: [].  I'm working on the module "Customize How Records Get Approved with Approvals".  I've seen that other people have gotten the same error, but none of the solutions seem to apply for whatever is messing mine up.  I've included a screenshot.  Any advice would be appreciated!  Thank you in advance!
User-added image
Best Answer chosen by Kathryn Puzzanghera
Bala Gangadhar VadlamuriBala Gangadhar Vadlamuri
Hi Kathryn Puzzanghera, Initial criteria should be "Account: Type equals Prospect". try changing it.
Regards,
Bala
Chris MarzellaChris Marzella 
I'm not sure where I am going wrong. Any help would be appreciated.

Here is my code:
public class StringArrayTest {
    public static String[]generateStringArray(){
        List<String> Test = new List<String>{'Test 0', 'Test 1', 'Test 2'};
            
            for(Integer n=0; n<Test.size(); n++){
                System.debug('Test' + n);
            }
        return Test;
    }
}
This is the error:
Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.
 
Best Answer chosen by Chris Marzella
William TranWilliam Tran
You need to pass in a parameter x
and make sure Test has a space in it like 'Test ' + n

Try this:

thx.
 
public class StringArrayTest {
    public static String[]generateStringArray(Integer x){
        List<String> Test = new List<String>(); 
            for(Integer n=0; n<x; n++){
            Test.add('Test ' + n);}  
            }
        return (Test);
    }
}
Amanda SalvaraniAmanda Salvarani 
Robot not working on this unit. Trail "Customize an Org to Support a New Business Unit" and unit is "Manage Users". I completed the challenge in two playgrounds (1 and 2) - but the robot is stuck at one user being incorrect (Fumiko Suzuki - who I created twice in PG 2 and again in PG 1. No luck getting the robot to recognize it. 
Any ideas on how to fix it??
 
Best Answer chosen by Amanda Salvarani
SandhyaSandhya (Salesforce Developers) 
Hi,

Only thing I can see is you have not created a role as "
Customer Support, International" try to edit the record and provide role as 
Customer Support, International and then check challenge.

Best Regards,
Sandhya
Jean Velonis 21Jean Velonis 21 
I'm trying to limit the user when they use a botton to only be able to have one record if they don't have any other records in the status of "New". 


global with sharing class RetrieveNextUtils {
    webService static Id retrieveNextCase(String userId)
    {
        //Here I'm looking to see if the current user has any leads in Lead Status containing New
        
        
        //Really we're only specifying the user ID for the sake of the test methods
        if (userId=='') {
            //Use the currently running user
            userId = UserInfo.getUserId();
        }
        
        //First find out which queues this user is a member of
        List<Id> listGroupIds = getQueuesForUser(userId);
        
        if(listGroupIds.size()>0) 
        {
            //Find an open case that is assigned to one of those queues
            Case caseObj = [select c.Id,c.OwnerId from Case c where 
                                                        c.IsClosed=false 
                                                        and c.OwnerId in :listGroupIds 
                                                        limit 1 
                                                        for update];
                                                
            if (caseObj!=null) {        
                //If we found one, assign it to the current user
                caseObj.OwnerId = userId;
                update caseObj;
                
                return caseObj.Id;
            }
        }
        
        return null;
    }
    
    webService static Id retrieveNextLead(String userId)
    {
        //Really we're only specifying the user ID for the sake of the test methods
        if (userId=='') {
            //Use the currently running user
            userId = UserInfo.getUserId();
        }
        
        //First find out which queues this user is a member of
        List<Id> listGroupIds = getQueuesForUser(userId);
        
        if(listGroupIds.size()>0) 
        {
        
            
            //Find an open lead that is assigned to one of those queues
            List<Lead> leads = [select l.Id,l.OwnerId from Lead l where 
                                                        l.IsConverted=false 
                                                        and l.OwnerId in :listGroupIds 
                                                        limit 1 
                                                        for update];
                                                
            if (leads.size()>0) {       
                //If we found one, assign it to the current user
                leads[0].OwnerId = userId;
                update leads;
                
                return leads[0].Id;
            }
        }
        
        return null;
    }
    
    //Returns a list of ids of queues that this user is a member of
    public static List<Id> getQueuesForUser(String userId) 
    {
        List<Id> listGroupIds = new List<Id>();
        List<GroupMember> listGroupMembers = [Select g.GroupId From GroupMember g 
                                                where g.Group.Type='Queue'
                                                and g.UserOrGroupId=:userId];
                                                
        if (listGroupMembers!=null && listGroupMembers.size()>0) {      
            for (GroupMember gm:listGroupMembers) {
                listGroupIds.add(gm.GroupId);
            }
        }
        
        return listGroupIds;
    }
    
    
        
   
}
Best Answer chosen by Jean Velonis 21
Daniel BallingerDaniel Ballinger

Try something like the following:

webService static Id retrieveNextLead(String userId) {
    //Really we're only specifying the user ID for the sake of the test methods
    if (userId=='') {
        //Use the currently running user
        userId = UserInfo.getUserId();
    }
        
    List<Lead> existingUserNewLeads = [Select Id, Name, Status, IsConverted 
                                       From Lead 
                                       where 
                                           OwnerID = :userId 
                                           and IsConverted = false 
                                           and Status = 'New'];
    if(!existingUserNewLeads.isEmpty()) {
        // This user already has a Lead with Status New assigned to them
        // Don't let them be greedy and get another lead until they are finished with their current one.
        // No more leads for you!
        return null;
    }

    //First find out which queues this user is a member of
    List<Id> listGroupIds = getQueuesForUser(userId);
    // ... Existing method code
    return null;
}
dai tran 6dai tran 6 
In Setup ->Sanboxes: i click create sanbox:
User-added image
apex class: What is input?

I had try create a apex class , but it not allow:
User-added image
How can create a sanbox?
i using  a trial Lightning enterprise at: https://www.salesforce.com/ap/editions-pricing/service-cloud/
 
Best Answer chosen by dai tran 6
GoldiGoldi
You do not need to fill that out, skip and simply click create