• md saif ansari
  • NEWBIE
  • 4 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
@RestResource(urlMapping='/Widgets/*')
global with sharing class WidgetController {
    @HttpGet
    global static string doGet() {
        RestRequest req = RestContext.request;
        String FirstName = req.params.get('FirstName');
        String LastName = req.params.get('LastName');
        String Phone = req.params.get('Phone');
        String Email = req.params.get('Email');
        Lead ld = new Lead();
        ld.FirstName = FirstName;
        ld.LastName = LastName;
        ld.Phone = Phone;
        ld.Email = Email;
        ld.Company = 'FAP Form';
        insert ld;        
        return 'success....';
    }    
}
which two Apex data types can be used to reference a salesforce record ID dynamically?
Choose 2 answers
a) External ID.
b) Subject.
c) ENUM.
d) String.
@RestResource(urlMapping='/Widgets/*')
global with sharing class WidgetController {
    @HttpGet
    global static string doGet() {
        RestRequest req = RestContext.request;
        String FirstName = req.params.get('FirstName');
        String LastName = req.params.get('LastName');
        String Phone = req.params.get('Phone');
        String Email = req.params.get('Email');
        Lead ld = new Lead();
        ld.FirstName = FirstName;
        ld.LastName = LastName;
        ld.Phone = Phone;
        ld.Email = Email;
        ld.Company = 'FAP Form';
        insert ld;        
        return 'success....';
    }    
}
Hi All ,
How to pass <lightning:select > and <lightning:input > values from child component to parent component 
i'm preparing the data on child component (user UI from with mutiple rows) and i have save button on parent component , when i'm click on save button  all the input field values need to bring from child component to parent ,i'm using component event but values are not getting....
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.

Hi Everybody,

I have the below Simple apex code 

 

global class ReportTest1 implements System.Schedulable{
     global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
     }
}

 

 

Now i am scheduling this for running Every 5 hours and the scheduler runs fine , but i get the blank report.


Now if i change the above class to below , I get a perfect Report when CONSTRUCTOR IS invoked but When scheduler is run i get a blank report   :(

 

global class ReportTest1 implements System.Schedulable{
public ReportTest1()
{
Starter();
}
public void Starter()
{
ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
}
 
     global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
     }
}
 

 

Kindly I request your expert advise.

 

Regards,

San

 

 

  • May 16, 2013
  • Like
  • 0