• Pablo Gonzalez Alvarez 3
  • NEWBIE
  • 50 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 15
    Replies
Hi,
I am trying, without success, to understand the second paragraph below (written in Trailhead):

User-added image
My interpretation of this second paragraph is that, if you have class where one of its methods contains a if-condition statement where, under certain condition the code is executed synchonously and under other condition a code is executed asynchronously, then (according to this 2ond paragraph) you would be better off leveraging a future method? (instead of a Queueable apex?)

The question is WHY?
Could you possibly clarify/elaborate so as to fully understand the above paragraph #2?

Thank you.
  • December 20, 2017
  • Like
  • 0
Hi all,

I have completed Step 6 of this super badge and I've confirmed that the functionality works just fine, but I'm getting the following error

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

In my code, I'm already using this constant to query the chatter group id when building the announcement, in Product2Helper
 
List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup  WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS LIMIT 1];
            
announcement.parentId = chatterGroups[0].Id;

I've also tried
 
announcement.parentId = [SELECT Id FROM CollaborationGroup  WHERE Name = :constants.INVENTORY_ANNOUNCEMENTS][0].Id;
Has anyone faced this error? How did you build the query? 
 
I am calling a server side action from a Lightning Component. When an error occurs I am trying to log them in a custom object using an @future method and then throwing an AuraHandledException so the component can display the message. It seems like this won't work with AuraHandledException since it causes a Script-thrown execption in the logs which causes the @future method not to execute. Am I doing something wrong or is there another way to accomplish it?

Here is documentation I am referencing:

Error Handling Best Practices for Lightning and Apex:
https://developer.salesforce.com/blogs/2017/09/error-handling-best-practices-lightning-apex.html

An Introduction to Exception Handling:
https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling
 
@auraEnabled
public static void getSomething(){
    
    try{
        //Do Something here 
        
    }catch(exception e){
        
        //@future - log error in custom object
        futureCreateErrorLog.createErrorRecord(e.getMessage());
        
        throw new AuraHandledException('Error message to display in component');
    }
    
}

User-added image
Hi,
I am trying, without success, to understand the second paragraph below (written in Trailhead):

User-added image
My interpretation of this second paragraph is that, if you have class where one of its methods contains a if-condition statement where, under certain condition the code is executed synchonously and under other condition a code is executed asynchronously, then (according to this 2ond paragraph) you would be better off leveraging a future method? (instead of a Queueable apex?)

The question is WHY?
Could you possibly clarify/elaborate so as to fully understand the above paragraph #2?

Thank you.
  • December 20, 2017
  • Like
  • 0
We have an SObject MyObject__c with a custom validation rule that says either FieldA__c or FieldB__c must be filled in, otherwise throw an error.

We want this to be reflected on custom lightning forms that we create for inserting or updating MyObject__cs. For example, if we have a form for inserting a MyObject__c, we want to be able to disable the save button until either FieldA__c or FieldB__c is filled in. We plan to add more fields with similar validation rules, so we would like to be able to do this dynamically.

Is there a way we can reference the validation rule either in Lightning or in Apex to dynamically mark that certain fields must be filled in when others arent? Or is the best way to just hard-code it in whatever lightning component we create?
I'm working on this Trailhead challenge : Save and Load Records with a Server-Side Controller
As required, I've created an Apex class to write my server-side controller - CampingItemController.
My code seems perfectly alright. I've tried with other code too that seems to work for others too. 
The problem is that my console tells me that Camping_Item__c is an invalid type. I don't seem to understand where I went wrong. Would appreciate if someone couldhelp me with this. Have been stuck with this for a really long time.  User-added image

 
Hi all,

I have completed Step 6 of this super badge and I've confirmed that the functionality works just fine, but I'm getting the following error

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

In my code, I'm already using this constant to query the chatter group id when building the announcement, in Product2Helper
 
List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup  WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS LIMIT 1];
            
announcement.parentId = chatterGroups[0].Id;

I've also tried
 
announcement.parentId = [SELECT Id FROM CollaborationGroup  WHERE Name = :constants.INVENTORY_ANNOUNCEMENTS][0].Id;
Has anyone faced this error? How did you build the query? 
 
Sorry for the hijack, I can't create my own post.

Error: 
Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.

I am having an issue with validating the ext.getTotalPages method.
 
/**
     * @name GetTotalPages
     * @description
    **/
    public Integer getTotalPages(){
        return ((Decimal)this.standardSetController.getResultSize() / (Decimal)Constants.DEFAULT_ROWS).round(System.RoundingMode.CEILING).intValue();
    }

Here is my method toSetStandardSetController 
 
private void setStandardSetController() {
        if (this.selectedFamily != Constants.SELECT_ONE && this.selectedFamily != null) {
            this.standardSetController = new ApexPages.StandardSetController(Database.getQueryLocator([
                    SELECT
                            Id,
                            Product2.Name,
                            Product2.Family,
                            Product2Id,
                            UnitPrice,
                            Product2.Quantity_Remaining__c
                    FROM
                            PricebookEntry
                    WHERE Product2.IsActive = true
                    AND Product2.Family =: this.selectedFamily

            ]));
        } else {
            this.standardSetController = new ApexPages.StandardSetController(Database.getQueryLocator([
                    SELECT
                            Id,
                            Product2.Name,
                            Product2.Family,
                            Product2Id,
                            UnitPrice,
                            Product2.Quantity_Remaining__c
                    FROM
                            PricebookEntry
                    WHERE Product2.IsActive = true
            ]));
        }

        this.standardSetController.setPageSize(Constants.DEFAULT_ROWS);
    }

 
HI All,

I am trying to complete PD 2 Superbadge (Advanced Apex Specialist), I have tested every product and pricebookentry records, still i am not able to complete challenge.

Update the new product Visualforce page(Update the Product2New Visualforce page and Product2Extension class to meet the business requirements.)

Challenge Not yet complete... here's what's wrong: 
Ensure that the PricebookEntries are saved on the standard Pricebook.

please suggest. 
Thanks
I am getting below error
User-added image

but my application has 
User-added image

May I know why am not able to pass this challenge ?
 
Hey All,
I was wondering is there any website where we can find some lightning tasks or challenges we can do to polish our skills in lightning? 

P.S. I am not talking about Trailhead...Already done that !