• Navin Dayama 2
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I am trying to invoke a trigger when an answer is marked as Best Answer in Chatter (not in Community). I tried a trigger on FeedItem and FeedComment objects, but the triggers were not invoked when I mark an answer as a Best Answer. Can someone help?
Question, does record view form in communities only work if the user is logged into Salesforce? I can't seem to get my output fields to display for a guest user. I have a guest profile set up with read access on this object and the fields yet on the community he's unable to see the output fields. There is a sharing rule for the guest profile to have access to these objects. 
Hi All,

Can anyone please help me with bellow challenge.


Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.
For this challenge, you need to create a trigger that, before insert or update, checks for a checkbox, and if the checkbox field is true, sets the Shipping Postal Code (whose API name is ShippingPostalCode) to be the same as the Billing Postal Code (BillingPostalCode).The Apex trigger must be called 'AccountAddressTrigger'.
The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.

For above challenge i tried with following code but looks like it doesnt mach the requirement.

trigger AccountAddressTrigger on Account (before insert, before update) {
    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c = true) {
            /*ShippingPostalCode = BillingPostalCode;*/
        }   
    } 

}

Please help me

 

 

 

I am trying to parse Date string to Date data type


While executing Anonymous code below 
Date Birthdate = date.parse('09-05-1954');
System.debug('Birthdate '+ Birthdate); 

throws exception
6:11:11.041 (41552000)|EXCEPTION_THROWN|[1]|System.TypeException: Invalid date: 09-05-1954
16:11:11.041 (41707000)|FATAL_ERROR|System.TypeException: Invalid date: 09-05-1954

But Date String with Slash works fine
Date Birthdate = date.parse('09/05/1954');
System.debug('Birthdate '+ Birthdate); 

Output

16:15:26.160 (160415000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
16:15:26.161 (161357000)|USER_DEBUG|[2]|DEBUG|Birthdate 1954-09-05 00:00:00

This happens only for US locale.

 

Any idea - how to solve this?