• Mario Parise
  • NEWBIE
  • 50 Points
  • Member since 2017
  • Software Developer
  • Legend Boats

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 33
    Replies
Which SOQL query successfully returns the Accounts grouped by name? 

A. SELECT Id, Type, Max(CreatedDate) FROM Account GROUP BY Name 
B. SELECT Name, Max(CreatedDate) FROM Account GROUP BY Name 
C. SELECT Type, Name, Max(CreatedDate) FROM Account GROUP BY Name LIMIT 5 
D. SELECT Type, Max(CreatedDate) FROM Account GROUP BY Name
Howdy,

Working through the Cat Rescue trailhead, I've run into an issue where every time I try to upload a picture to one of the cat's, I get this error:
 
EXCEPTION_THROWN [77]|System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

The error is being generated by line 77 on EinsteinVision_HttpClient.cls, which I've never edited.

Has anyone else run into this and resolved it?

 
Which SOQL query successfully returns the Accounts grouped by name? 

A. SELECT Id, Type, Max(CreatedDate) FROM Account GROUP BY Name 
B. SELECT Name, Max(CreatedDate) FROM Account GROUP BY Name 
C. SELECT Type, Name, Max(CreatedDate) FROM Account GROUP BY Name LIMIT 5 
D. SELECT Type, Max(CreatedDate) FROM Account GROUP BY Name
@AuraEnabled
    public static String insertinfo(String caseId, String accountId, List<String> results)
    {
        system.debug('ffmap'+results);    
        list<objectWrap> myWrap = (list<objectWrap>)results;    //Getting error here . Also ffmap is not coming in the valid format 
 }
ffmap log :- ({key=123, value={key1=KEITH W PETERSON, key2=123, key3=null, key4=Bronze, key5=31-Jan-2019}}, {key=456, value={key1=JOYCE P WEST, key2=456, key3=xdkzwhzorm@uaowz.qca, key4=Bronze, key5=31-Jul-2018}})

From helper i am getting proper json format whereas in the apex ctrlr am getting the result in valid format
My helper class :- 

CreateHelper: function(component, event) {
        //call apex class method
        var action = component.getinsertinfo
            var myMap = component.get("v.selectednos");
            console.log('Mymapvalue' + myMap);
            action.setParams({
                "caseId": component.get("v.CaseId"),
                "accountId" : component.get("v.AccountId"),
                "results" : myMap
            });

log:-
Mymapvalue'  :-   [{"key":"123","value":{"key1":"KEITH W PETERSON","key2":"123","key3":null,"key4":"Bronze","key5":"31-Jan-2019"}},{"key":"456","value":{"key1":"JOYCE P WEST","key2":"456","key3":"xdkzwhzorm@uaowz.qca","key4":"Bronze","key5":"31-Jul-2018"}}]
Hey guys,

i am trying to prevent the user from creating a record with this validation - formula:
IF( {!Abwesenheitsgruende} = {!KrankheitIdUndName.Id}, 
(
 TODAY() - {!Beginn} < 15 &&  
 YEAR(TODAY()) - YEAR({!Beginn}) > -1 
)
,
(
 TODAY() - {!Beginn} < 1 &&
 YEAR(TODAY()) - YEAR({!Beginn}) > -1
)
)
&&
{!Ende} - {!Beginn} >= 0


Unfortunaly this formula everytime evaluates to true. Do you have any suggestions?
I appreciate it!

Hi there! I need a way to initialize the Live Agent button manually for custom javascript events (rather than just on DOM ready). Is there any documentation on this or does anyone have any experience with this?

Thanks,
Laney
I am trying to figure out how to create the address field in the parent account.  It needs to look at the children, and if all children are the same, then output the address.  If children have different addresses, then output "Multiple".

How should I approach this?
 We have a business requirement for only part of our quoting business to occasional show an extra decimal point on the unit price in Quote line items and Quote total price. We're using standard fields and standard quote object. Wondering if anyone else has had this challenge or knows how to best set it up? Thanks! 

I have a class which looks for if there is a PDF already attached to a custom object record as well as a date field being less than TODAY. How do I have this class attach an additional file if another parameter is met? For instance if there is already a PDF attached to the record called "Letter.pdf." I would like an additional letter to be attached because the record has been edited to SecondLetter__c = TRUE. Thanks for your help.

 

global class pdfBatch implements Database.Batchable<sObject> {
    
    String query;
    String filename = 'Letter.pdf';
    
    global pdfBatch() {
        query = 'SELECT Id FROM Application__c ';
        query += 'WHERE Publish_Date_Time__c < TODAY';
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Application__c> scope) {
        String[] appIDs = new LIST<String>();
        for(Application__c app : scope){
            appIDs.add(app.id);
        }
        SET<String> appIDsWithPDFs = new SET<String>();
        for(Attachment atchmnt : [
            SELECT ParentId 
            FROM Attachment 
            WHERE name =:filename
            AND ParentId IN :appIDs
            LIMIT 5000
        ]){
            appIDsWithPDFs.add(atchmnt.ParentId);
        }
        Attachment[] attachments = new LIST<Attachment>();
        for(Application__c app : scope)
        {
            if(appIDsWithPDFs.contains(app.id)) continue;
            PageReference pdf = Page.Letter_PDFer;
            // add parent id to the parameters for standardcontroller
            pdf.getParameters().put('id',app.id);

            // the contents of the attachment from the pdf
            Blob body;

            try {

            // returns the output of the page as a PDF
            body = pdf.getContent();

            // need to pass unit test -- current bug  
            } catch (VisualforceException e) {
            body = Blob.valueOf('An error occurred.');
            }

            Attachment attachment = new Attachment();
            attachment.Body = body;
            attachment.Name = String.valueOf(filename);
            attachment.ParentId = app.id;
            attachments.add(attachment);
        }
        if (attachments.size()>0)
            insert attachments;     
    }
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}

  • September 25, 2018
  • Like
  • 0
I am wondering if there is a way to view a variables contents in the console in chrome?  I am using the following line of code in my controller:

console.log('here is group structure list' + component.get("v.groupstructureList"));

When I look at the results in the console, I only see:

here is group structure list[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Is there a way to see the real contents of the variable?

thanks!!

Fred
  • September 25, 2018
  • Like
  • 0
I'm trying to develop an Apex Trigger. I've created a Sandbox environment cause you can't do this directly in production. I've connected my Eclipse IDE to the sandbox (I can run queries on it so i know its connected), but I can't created anything Apex related. I go New -> Apex Trigger and receive this on the popup: "Apex Code is not enabled in this project.  Check permission and connection settings." I've read that some "Author Apex" setting needs to be enabled but I have yet find this option anywhere. I'm a System Administrator so I don't think i lack permissions, but even in the user interface, trying to create a new trigger on an object gives me this:
"Insufficient Privileges. You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors."

I don't understand why I can't do anything even in my sandbox environment. Since it fails in the user interface, I believe the hang up is in Salesforce and not my Eclipse environment, but I can't find anything that lets me enable this. Is the "Author Apex" option the only thing I'm missing? Where is it? Shouldn't it be right in the User/Profile settings? And isn't this enabled in Sandbox by default? I thought that was the point to the Sandbox environment. Thanks in advance for any insight.
Hi All,

I am new to SF. I have been completing quite a few challenges now, I am stuck in this one for long.

https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components3

Quite frustrating actually.

Everytime I get this error:
There was an unhandled exception. Please reference ID: BCGRRLJQ. Error: Faraday::ClientError. Message: MALFORMED_QUERY: When retrieving results with Metadata or FullName fields, the query qualificatio​ns must specify no more than one row for retrieval. Result size: 3

I looked at other similar post, but not helpful.

I tried adding limit in Controller and checked the query in SOQL editor also. The result returned is always 1. I tried in multiple trailhead Playgrounds still the same.

Not sure where I am going wrong. Any suggestions will help.

Thanks,
Pramod V