• NitishMishra
  • NEWBIE
  • 10 Points
  • Member since 2012
  • Developer
  • Deloitte Ireland


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hi, 
I have enabled state and picklist value in client's unlimited org. I need to access only dependent state based on selected Country code. There are some integration and other apex changes where I need only dependent state value in a Map( like  : 'MH'=> 'Maharastra')... I am using below code but It will give all the state values. I need only states based on country values. e.g. : For Indian it should have only 35 state which belong to India only. 
Schema.DescribeFieldResult F = Contact.MailingStateCode.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();

System.debug('-----P--->>'+P[0]);
Map<String, String> tempMap = new Map<String, String>();
for(Schema.PicklistEntry sp : P){
    tempMap.put(sp.getValue(), sp.getLabel());
}

System.debug('----tempMap-----'+tempMap.get('MH'));  // Here it is returning 'Meath' as MH will be state code for some other states as well 
System.debug('----tempMapVALUE-----'+tempMap.get('UP'));

Any help will be appreciated. Thanks in Adance !!
 

I am trying to capture the specific Date/time an email was sent in Saleforce. Currently have Workflow with a field update but it's not returing any values. Any suggestions?

Here is my current setup.

Workflow Rule Detail
Task equals Completed
Subject contains Email:

Field Update
Custome field  = Completed Date/Time
Formula NOW()

I have a custom button which populates the account name on a custom activity field using Javascript OnClick. Works great except if the account name has an apostrophe. How would I escape any potential apostrophes from Account.Name in the following javascript?

 

navigateToUrl('00T/e?who_id={!Account.Primary_Contact_Lookup__c}&retURL={!Account.Id}&00N80000004QVPs={!Account.Name}');