• Adam Dillman
  • NEWBIE
  • 15 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hey everyone, this is something I've been struggled with and I can't find a concrete answer. I have a lightning component that accepts a URL parameter. For example if I navigate to the following link:

https://myorg.lightning.force.com/lightning/cmp/testcomponent?testparameter=4082545672 

It works, and my testparameter field is automatically initialized with the parameter value as I had hoped. 

However, when I move this lightning component to a lightning console app, this functionality no longer works. Instead, the console seems to accept only a single URL parameter, "uid" (?). So my link actually redirects automatically to:

https://myorg.lightning.force.com/lightning/cmp/testcomponent?uid=1654451398147

So my questions is, is it not possible to pass URL parameters into a lightning console app? If not, can you please point me to Salesforce documentation stating this? Thanks. 
Hi All,

I am having some trouble getting this code snippet to work. I am relatively new to Apex and DML/SOQL so it could be something simple. My goal is, given a list of accounts, determine the number of contacts belonging to each account, and then update a field called Number_of_Contacts__c with that value. Here's what I came up with:
public class AccountProcessor {

    public static void countContacts(List<ID> recordIds){  //take a list of recordids
        
        List<Account> accountlist = 
        [Select name FROM Account WHERE ID IN :recordIDs];  //get a list of the corresponding accounts
        
        for(Account tempaccount: accountlist){  //for each account in this list...
            
            Integer contactCount = 0;
            contactCount = 
            [SELECT Count() from CONTACT WHERE contact.account.ID = :tempaccount.ID];
            //count the number of contacts associate with each account

            tempaccount.number_of_contacts__c = contactCount;
            update tempaccount;
            
        }
    }
}
I am trying to run this code using the following anonymous execution:
AccountProcessor.countContacts(001f400000KfIMbAAN);
I'm not sure if the AccountID should be in quotes are not, but it doesn't work either way. I keep getting the following error:

Line: 1, Column 31 Unexpected token '('.

Any ideas where I'm going wrong? Also, I know my code is violating several "Best Practices" but I'm just trying to figure things out at the moment. Thanks!





 
Hi All,

I am having some trouble getting this code snippet to work. I am relatively new to Apex and DML/SOQL so it could be something simple. My goal is, given a list of accounts, determine the number of contacts belonging to each account, and then update a field called Number_of_Contacts__c with that value. Here's what I came up with:
public class AccountProcessor {

    public static void countContacts(List<ID> recordIds){  //take a list of recordids
        
        List<Account> accountlist = 
        [Select name FROM Account WHERE ID IN :recordIDs];  //get a list of the corresponding accounts
        
        for(Account tempaccount: accountlist){  //for each account in this list...
            
            Integer contactCount = 0;
            contactCount = 
            [SELECT Count() from CONTACT WHERE contact.account.ID = :tempaccount.ID];
            //count the number of contacts associate with each account

            tempaccount.number_of_contacts__c = contactCount;
            update tempaccount;
            
        }
    }
}
I am trying to run this code using the following anonymous execution:
AccountProcessor.countContacts(001f400000KfIMbAAN);
I'm not sure if the AccountID should be in quotes are not, but it doesn't work either way. I keep getting the following error:

Line: 1, Column 31 Unexpected token '('.

Any ideas where I'm going wrong? Also, I know my code is violating several "Best Practices" but I'm just trying to figure things out at the moment. Thanks!





 
I am working on the App Customization Specialist Superbadge and this one has me baffled. Here is the part I'm stuck on...

Quick Self Sign Up
Maria asked for a quick way for users to sign themselves up for a Shift directly from a Volunteer Shift record. Your solution was an action with the label Sign Me Up. To keep it simple there should be no fields on the pop-up. Instead the action automatically sets the Volunteer to the user clicking the button, changes the status to Confirmed, and assigns the currently viewed Shift as the new record's Volunteer Shift. Once the action is done show the friendly message "Congratulations, you are signed up!".

Based on what I'm reading, they seem to be asking me to create a Quick Action button that creates a new record with the necessary fields set to default values. The problem is that two of the fields that are required are Lookups that I was required to create in the first challenge. One to supply the User Name and another to supply the Volunteer Shift Name. Quick Action default values can't populate Lookup fields, right? I tried creating a flow, but you can't trigger an autolaunched flow from a Quick Action, only Screen Flows. The challenge wants one button click and it's done. Can someone tell me what I'm missing here?
Challenge Requirements:
Create a flow:
Name: New Lead
Type: Screen Flow
In the flow, add a screen with these required screen fields.
Last Name
Company Name
In the flow, create a lead record.
Use the screen fields to set the lead’s Last Name and Company.
Store the lead’s ID in a Text variable called leadId.
In the flow, add another screen with a Lightning component screen field.
Name the field Upload_File
Choose the forceContent:fileUpload Lightning component.
Use the leadId variable to set the component's Related Record ID attribute.
Activate the New Lead flow.
Create a new Lightning page:
Type: Home page
Label: Process Automation Home
In Process Automation Home, add a Flow component that references the New Lead flow.
Activate the page and set it as the default Home page.

I did all of this and yet it says it cannot detect force content?User-added image
User-added image