• Charles Naughton 7
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I'm trying to parse JSON to extract a Zip Code from a JSON response. Instead of returning "10019-6018", the parser is returning "null10019-6019". Why is it inserting "null" in front of the value?

Here's the body of JSON response:
 
{"Addresses":[{"Address1":"787 7th Ave Fl 8th","Address2":"","City":"New 
York","State":"NY","Zip":"10019-018","IsResidential":"","DPV":"3"}],"IsCASS":true}

Here's a snippet of code showing what I'm doing with the parser:
 
HttpResponse response;
        response = h.send(req);
        System.debug(response.getBody());
        JSONParser parser = JSON.createParser(response.getBody());
        String resPostalCode;
        while(parser.nextToken() != null) {
            if((parser.getCurrentToken() == JSONToken.FIELD_NAME) && 
               (parser.getText() == 'Zip')) {
                   parser.nextToken();
                   resPostalCode += parser.getText();
            }
        }
        system.debug(resPostalCode);

 
I'm trying to display a parent field value in the subject line of a VisualForce email template and I'm running into problems. The use case is that we're going to fire an email alert that is based on a workflow rule on the child object.

Here's what I've got:

Parent object: Case
Parent object field: CaseNumber
Child object: n2de__Distribution_log__c

And here's how I've started, but I'm running into an error when saving. What am I missing?


<messaging:emailTemplate subject="Alert: 25 Minutes Before {!relatedTo.Case__r.CaseNumber} Misses Target" recipientType="User" relatedToType="n2de__Distribution_log__c"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

The error text is:
Error: Invalid field Case__r for SObject n2de__Distribution_log__c
I'm trying to display a parent field value in the subject line of a VisualForce email template and I'm running into problems. The use case is that we're going to fire an email alert that is based on a workflow rule on the child object.

Here's what I've got:

Parent object: Case
Parent object field: CaseNumber
Child object: n2de__Distribution_log__c

And here's how I've started, but I'm running into an error when saving. What am I missing?


<messaging:emailTemplate subject="Alert: 25 Minutes Before {!relatedTo.Case__r.CaseNumber} Misses Target" recipientType="User" relatedToType="n2de__Distribution_log__c"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

The error text is:
Error: Invalid field Case__r for SObject n2de__Distribution_log__c