• Peter_sfdc
  • 998 Points
  • Member since 2012

  • Chatter
  • 25
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
  • 191
I am planning to take the 201, 211 and 401 certifications - does anyone know do the Trailhead modules align to these and if so which modules do you need to do for each certification?

Thanks all
Hi there, I 'm trying to complete the "Automating Processes with the Lightning Process Builder" challenge in TrailHead but I get the following error :
Encountered unhandled fault when running process Update_contact_adress/
301240000004FXO exception by user/organization: 00D24000000JsNt/{4}

The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
caused by element : FlowRecordUpdate.myRule_1_A1
caused by: The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
Salesforce Error ID: 490660201-42718 (736882147)

Any idea what could be could wrong ?
I have created a Custom Object called Subgrantee Profile, using the SubgranteeProfileController. There's a Visuaforce page (let's cal it page 1) that renders the fields under different tabs. I want to clone this Visualforce page into Visualforce page 2, delete some tabs, and assign it to a specific profile A.

I have changed the setting under:
- Profile > Enable Visualforce Page
- changed the Page Layout Assignment
- changed the Security setting of the Visualforce Page 2.

But when I log in as a profile A user, I can only see page 1. The only way I can make page 2 show, is to go Create > Object > Subgrantee Profile > Buttons, Links, and Action > View, and change the content source to page 2. But this change the view to page 2 for ALL profiles, which I don't want.

So in short, my question is: can I assign 2 visualforce pages of the same custom object to different profiles?

Hey everyone,

I have an After Update trigger on the Account object that transfers the Contact owners to the current Account owner, while also setting a Contact field to a certain value. The problem is that when I manually transfer the account in Salesforce, the trigger doesn't work. But if I transfer the account by using something like Dataloader or Workbench, the trigger works.

Does manually transferring an Account in Salesforce not cause triggers to run?

My Controller : 
My Test:
User-added image

I want to write test for my controller but i can't. Can anyone help for this? Regards :)

I am getting  MarketMetricUpdate: System.LimitException: Too many SOQL  101 ....how to resolve this...can anyone correct below code.

Trigger MarketMetricUpdate on Market_Metrics__c(after insert,before update,after update)
  Map<string,Market_Metrics__c> BusinessMap = new Map<string,Market_Metrics__c>();
  set<id> Accountlist = new set<id>();
  set<string> ZipList = new set<string>();

  for(Market_Metrics__c b: Trigger.new)
    if(String.IsNotBlank(b.Zip_Code__c) && String.IsNotBlank(b.SFDC_Account_Name__c))
Map<id,contact> ContactList = new Map<id,contact>([select id,Accountid,MailingPostalCode from Contact where Accountid IN : AccountList and MailingPostalCode IN:ZipList]);
  List<contact> cUpdate = New List<Contact>();
  for(Contact c : ContactList.values())
      c.Market_Metrics__c = BusinessMap.get(c.MailingPostalCode+c.Accountid).id;

   update cUpdate;

  • February 05, 2014
  • Like
  • 0
I have this custom url that is used to get the lat/long for a record.  What I'd like to do is tack that function onto a trigger so that if the address is updated, the lat/long gets updated too.

This url sends the parameters to a VF page which processes that with the help of a class and updates the record.  The page and class are part of a managed package, so I can't see the class code.  I'm in a pinch, so I'm hoping to get something going quick.  I can work with the developer, but that will take weeks when I have days.

  • January 30, 2014
  • Like
  • 1
I have a 2 level parent child relationship and I am trying to use  a SOQL query ... SA (child) --> SQ  --> S. There is a one to many relationship between SA to SQ and SQ to S.

When I give a query like this ... I get a response but the last field with 2 relationships does not display anything - only [object Object] [ Am currently just trying in the Developer Console to get my query right ]

Select SA__c.Id, SA__c.Name,


from SA__c where
SA__c.SQ__r.S__c = 'a0Hi0000009S5jcEAC'

So I checked adding a field like this in the SA object and it gets displayed just fine !!!!

Hi Experts,


Im very new to salesforce so when i write the program in salesforce , so when i displaying the records in tabluar format but it showing some error "

Visualforce Error

System.QueryException: List has no rows for assignment to SObject
Class.mySecondController.getAccount: line 5, column 1 "


please check my code once ,


public class mySecondController {
  public Account getAccount() {
    return [select id, name,
            (select id, firstname, lastname
             from Contacts limit 5)
            from Account 
            where id =:System.currentPageReference().getParameters().get('id')];
  public String getName() {
    return 'My Second Custom Controller';

visual force page:


<apex:page controller="mySecondController" tabStyle="Account">
   <apex:pageBlock title="Hello {!$User.FirstName}!">
   You belong to the {!account.name} account.
   <apex:pageBlock title="Contacts">
   <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
    <apex:column >
    <apex:column >




I have been trying to incorporate two new custom fields into the page record for the Contact object.  I used an inbound change set to bring in the two new fields.  I then manually added these two new fields to the page layout for the Contact record using the standard page layout editor in the production environment.  While the two new fields appeared in the correct place on the editor, when I then selected preview, they didn't appear under any of the profiles either in the Preview Edit Page or in the Preview Detail Page.  They also don't appear in the actual Contact record.


I've tested this with moving the new fields to different places; making them required fields; saving; going back in and re-saving; etc., but nothing works: they simply will not appear on the Contact record.


The change set was prepared in the Winter '14 Sandbox, whereas our production environment is still Summer '13.


Please advise.


Many thanks.



  • September 12, 2013
  • Like
  • 0

My overall apex code coverage is 86% in production (With around 35 apex classes and triggers).


Now when I am trying to deploy 3 new classes with the code coverages of (100, 88 and 9),  it is throwing the error.


Average test coverage across all Apex Classes and Triggers is 73%, at least 75% test coverage is required.


Why is the overall coverage dropping to such a low %.  How is it calculated?


Im struggling to increase the percentage for 9% covered apex class.  Is there any way to deploy it ?


Also, I have tried adding 2 dummy classes with test classes of both 100%, still it remains at 73% ! 


Any workaround?  Let me know.



HI Experts,


Please let me know a solution if we can prevent opportunity deletion through validation also. I beleive we can do through the code. Suppose I have to prevent opportunity deletion based on 2 condtions as in validation below


OR(Isblank(Username__c), Isblank(Date__c) ))


So can we prevent deletion for one profile users , based on above conditions through Validation ???????


I appreciate your help....



Hello... I am trying to migrate a custom APP from one sandbox to another but cant seem to find the way to do it though Eclipse IDE. Can anyone please help?

  • August 26, 2013
  • Like
  • 0

I am Trying to Create Page Number Navigation for a Standard set controller.


Client  Needs buttons with page Number like 

 [First Page1] ... [5] - [6] - [7] - [8] - [9] - [10] ... [60-Last Page]


As Know we can have Nav Buttons like 

First -  Next - Previous - Last  given as a standard.


Now out of the box 

for Offset i have tried to get this form this link 



But when i did the same For standard set controller. i was unable to get it on load all the buttons. but when i hit next button and rerender the pannel i am able to get the Expected functionality as stated above.



Dynamic Components cannot be serialized. either they need to be transient to the view state.

My Dynamic component is loaded before the set con is constructed. such that to total number of pages is Zero on load.

now when i hit next button of SScont now as the total number of pages is available to the my component it displays the message.


What should i do to get it on load its sef please help if any one has come across the same issue.


















First time writing here so my apologies if I’m not as in depth / clear about my issue.


I’ve hit a brick wall with my formulas with my desired solution hitting its character limit. My work around was to involve a workflow rule that would complete a field update to determine if the "Commission cut-off date" exceeded the date of "Product added date"


I have the workflow rule created but i need it to evaluate the rule and run on a daily basis. Is it possible for me to use APEX or anything like that to automate a trigger for the workflow to run?

Any help would be greatly appreciated!!

Matt Tindall

Hi all,


I was wondering what the effect is of field level security in flows.


Example: according to field level security, a user can only see 5 fields out of 10 of an object.


When I create a visual flow, I define 10 inputfields (one for each field in the object). Nevertheless, my user should only see 5 of them. Is this automatically taken into account?


My guess is no because there is no link between my defined inputfields and the object itself. Correct? If so, is there any way to take the advantage of field level security into flows?





Hi everyone,

I want to add an Order to salesforce.

I have been searching on the internet an object already done and it's not the case.

So I hesitate between derivated SalesOpportunity object to manage inside an "Order" status and add some fields.

Or I can create a new custom object.

What are you thought on it?



why the field  which has look up is not visible  in criteria based when we trying to share to other user. other than  feilds of no look up are visible in criteria based condition.



String.escapeSingleQuotes method making the query not to return any results if string contains a single quote


I'm using the method String.escaapeSingleQuotes() to make the user entered input to be safe from external Injections.

Here is the code snippet I'm using:


        param = String.escapeSingleQuotes(param);

        return Database.query('SELECT Id, Name FROM Account WHERE Name LIKE \'%'+param+'%\'');


This works fine if name does not contain any single quotes. Some of the Account names are having single quotes. For Example: L'oreal, O'connor, O'reilly etc


When I pass "L'ore"  as the param, String.escapeSingleQuotes() methods adds some / and ' and makes it as bellow (got it from Debug statements). I tried running the bellow query from workbench/force.com Explorer, it returns 0 results. Is it the expected behaviour?


SELECT Id,Name FROM Account WHERE Name LIKE '%L\\\'ore%'


Hi, I have the requirement like this. Say I have a Visualforce page which has '<apex:page> This is a new page </apex:page>'. Then I want an audio player on that page which will play this exact statement "This is a new page." Is this possible to be done in Apex? Or through Javascript on Apex? If anyone has done this or know about how it can be implemented, please share the relevant steps and code. 
  • January 19, 2017
  • Like
  • 0
trigger Trg_IntegrityIndex on Project__c (before update) {
    for(Project__c P : Trigger.New){
        String PID = p.Id;
        Project__c P1=[select Id,Name,Status__r.Name, Value__c, ContractValue__c, Contract__r.Name, Country__c, Workflow__c, CreatedDate,Scope__c  from Project__c where Id=:PID];
        string Status =P1.Status__r.Name;
        String sContract =P1.Contract__r.Name;
        String sContractValue =String.Valueof(P.ContractValue__c);
        String sScope =String.valueof(P.Scope__c);
        String sIndustry=P.Industry__c;
        String sName=P.Name; //for Project name
        String sScopeReplace;
        Integer iScope =0;
        Boolean bBad=false;
        Boolean bFair=false;
        String sErrorComments='';
  List<News__c> News= [select Id,Date__c,Name from News__c where Project__c=:PID];
        if (News.Size() >0){
              for(News__c N :News){
              //Validation 8: News:News-Study    Should be within 90 days from today   except design build in contract type             
                if(Status=='Study' &&  !(sContract=='Design Build (DB)')){
                  if(N.Date__c > date.today() +90 && N.Date__c < date.today() +97){
                    bFair = True; 
                    sErrorComments +='Status-Study Should be within 90 days from today for News Record-' + N.Name + '\r\n'; 
                  }else if (N.Date__c > date.today() +97){
                    bBad= True; 
                    sErrorComments +='Status Study as exceeded 97 days from today for News Record-' + N.Name + '\r\n';                                         
i wrote test class below i dont know what is wrong in this can anyone have solutions for this . Kindly help me.

Public class testIntegrity{
    public static void init()
        List <Project__c> proj = New List<Project__c>();
        Public Static String PID = p.Id;
        Project__c sproj=[select Id,Name,Status__r.Name, Value__c, ContractValue__c, Contract__r.Name, Country__c, Workflow__c, CreatedDate,Scope__c  from Project__c where Id=:PID];
        Public Static String Status = sproj.Status__r.Name;
        Public Static String sContract =sproj.Contract__r.Name;
        Public Static String sContractValue =String.Valueof(sproj.ContractValue__c);
@isTest Static void testinsertproject()
        Project__c sproj = New Project__c();
        sproj.Parent__c = 'a042000000IPjwg';
        sproj.Name ='Abu Dhabi Commercial Bank - Office Building';
        sproj.Location__c ='a0I20000006hEdO';
        sproj.Workflow__c = 'Recalled';
        sproj.Status__r.Name = 'Study';
        sproj.Integrity_Errors__c='Scope Should be more than 5 Pointers for the Status :Design';
        sproj.Contract__r.Name='Design Build (DB)';
        sproj.Scope__c='Abu Dhabi Commercial Bank is constructing an office building in Abu Dhabi.\n\nScope of the project includes:\n*Office building (12-storey)\n*Associated facilities';
        insert sproj;
        News__c sobj = New News__c();
        sobj.Inactive__c = false;
        sobj.News__c = 'fsfsfdsgsddsf';
        sobj.Date__c = Date.valueOf('20-10-2017');
        sobj.Source_Type__c ='Primary';
        sobj.Number_of_Updates__c ='2';
        sobj.Project__c = sobj.Id;
        insert sobj;
        if(sproj.Status__c =='Study' && !(sproj.Contract__c=='Design Build (DB)'))
            String spro = String.valueof(sproj.Id);
            if(sobj.Date__c>date.today() +90 && sobj.Date__c<date.today() +97 )
            else if(sobj.Date__c > date.today()+97)
               //do nothing 

I have enabled platform encryption in my org. i want to decrypt that data using tenant secret ? please explain
I am planning to take the 201, 211 and 401 certifications - does anyone know do the Trailhead modules align to these and if so which modules do you need to do for each certification?

Thanks all
Hi there, I 'm trying to complete the "Automating Processes with the Lightning Process Builder" challenge in TrailHead but I get the following error :
Encountered unhandled fault when running process Update_contact_adress/
301240000004FXO exception by user/organization: 00D24000000JsNt/{4}

The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
caused by element : FlowRecordUpdate.myRule_1_A1
caused by: The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
Salesforce Error ID: 490660201-42718 (736882147)

Any idea what could be could wrong ?
Good afternoon,
I can't seem to figure out why my class for the "Getting Started with Apex: Unit 1" won't pass evaluation.  The class appears to work as expected when I run via the Execute Anonymous window, but the checker fails.

Here is my class:

public class StringArrayTest{
    public static void generateStringArray(integer q){
        list<string> test = new list<string>();
            for(integer i=0; i < q;i++){
            test.add('Test '+i);

When I run StringArrayTest.generateStringArray(9); in the EAW, I get the return I expected.

Hi there,

I'm looking to send information from a form that is already created and in use on a website to salesforce web to lead, have tried diferent methods but it doesn't record.

Its there a simple way of doing that?

Kind regards,

Hi, We have articles created using multilingual knowledge in Salesforce. The article have field rich text.

We are using anchor for navigation in same page. Anchor works fine in English but not in french and other languages.

I checked clicking on Source button and found in french lang the anchor name is not populated.

English (Working):
Link: <a href="#Required parts"><span class="ref_span">
Anchor: <a name="Required parts">Required parts</a></div>

French version (Not Working):
Link: <a href="#Pièces Requises"><span class="ref_span">
Anchor: <a name="" target="_blank">Pi&egrave;ces requises</a></div>

I tried work around each time clicking on source and put the name in anchor which works fine but its not good for user and publishers to go and manually change each time. Also this work around doesn't work in IE8.

Need your important inputs.. Thanks..
Hi , 
It`s bit urgent , can any one please help me to resolve the bellow issue 
Hi I am trying to move attachments from any outbound email message back to the parent, in this case it's Cases. I created a trigger on Attachment and check the incoming flag and copy the attachments and then delete but it never does anything. Has anyone come across this problem?
I have created a flow and to customize the flow ,i have created a vf page with the controller. So can anyone tell me that how to write a test class to call the flow ...?
I tried each and every possibility to know where i'm going wrong but still no luck. My issue is my search (i.e. filter) is working on Subject,Status and Date field for Task object .

Now i want to search for one more column which is "OwnerId" . I know it can be done using if condition something like below  but what should be "IF condition " to get to the goal ?

if (logical condition  to filter by owner) {
    qStr + ' and OwnerId in :ownerIds';

I'm really paralyzed and need help.

public class PagingTasksController1{

    public List<Task> Tasks;

    public Task del;
    public Task taskDel;
    public Integer CountTotalRecords{get;set;}
    public String QueryString {get;set;}
    public Integer OffsetSize = 0;
    private Integer QueryLimit =3 ;
    public List<Task> lstTasks {get;set;}
    public String searchText {get;set;}
    public String rowIndex {get;set;}
//   public List<Task> attendeeList {get;set;}
    public Date mydate;
    public Integer totalCount {get;set;}
    public string sortField = 'Subject';  // default sort column
    private string sApplySOQL = '';
   public List<Task> delattendeeList {get;set;}

    public List<Task> delAttendees {get; set;}

    public PagingTasksController1(ApexPages.StandardController controller) {

     taskDel= (Task)controller.getRecord();
     Tasks = [Select id,Subject,Status,ActivityDate from Task where OwnerId =: taskDel.Id];
    // this.Tasks=Tasks[0];
     totalCount = Tasks.size();

     delattendeeList = new List<Task>();
     delattendees = new List<Task>();

// the current sort direction. defaults to ascending
    public String sortDir {
        get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }

    // the current field to sort by. defaults to role name
    public String getsortField() {
        return sortField;

    // the current field to sort by.
    public void setsortField(string value) {
        sortField = value;
    // toggles the sorting of query from asc<-->desc
    public void toggleSort() {
        // simply toggle the direction
        sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
        integer iIndex = sApplySOQL.indexOf('Order By');
        if (iIndex > -1){
          sApplySOQL = sApplySOQL.substringBefore('Order By');
          sApplySOQL = sApplySOQL + ' Order By ' + sortField + ' ' + sortDir +  ' limit ' + QueryLimit + ' offset ' + OffsetSize;
        tasks = Database.query(sApplySOQL );
    public PagingTasksController1 (){
        //CountTotalRecords= [select count() from Task];
        //String qStr2= '7/23/2014';

   public List<Task> getTasks(){
        if(tasks == null){
            tasks = new List<Task>();
        return tasks;

    public void findTasks(){
        String qStr2 = 'Select count() from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\'';
        CountTotalRecords = Database.countQuery(qStr2);

    public void  queryTasks(){
        String qStr2= searchText;
        String strnormal = '';
             mydate = date.parse(qStr2);
        }catch(Exception e)
        { }
        String strDate = '';
        if(mydate != null) {
         // strnormal = String.valueOf(mydate );
          String[] qstr3 = String.valueOf(mydate).split(' ',2); 
          strDate = ' ActivityDate =  '+ qstr3[0] + ' ';
           strDate  =  'Subject like \'%'+searchText +'%\' OR Status like \'%' +searchText+ '%\' Order By '  + sortField;
        String qStr = 'Select OwnerId,Subject,Status,ActivityDate from Task where '  + strDate   ;

         System.debug(qStr );
//        String qStr = 'Select OwnerId,Subject,Status,Priority from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+ '%\' Order By ' + sortField;

        sApplySOQL = qStr;
        tasks = Database.query(sApplySOQL );


    public Boolean getDisablePrevious(){
            return false;
        else return true;

    public Boolean getDisableNext() {
        if (OffsetSize + QueryLimit < countTotalRecords){
            return false;
        else return true;

    public PageReference Next() {
        OffsetSize += QueryLimit;
        return null;

    public PageReference Previous() {
        OffsetSize -= QueryLimit;
        return null;

      public PageReference save() {
        update tasks;
        return ApexPages.CurrentPage();
    public void deleteRow(){

         rowIndex = String.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
         System.debug('rowIndex ------------'+rowIndex );
         Task check=[Select id from Task where id=: rowIndex];
         System.debug('row to be deleted ' + check);
         delete check;
         Tasks=[Select Subject,Status,ActivityDate,OwnerId from Task ];
         update Tasks;

Can we call one Apex:Component inside the other Apex:Component?

Please suggest some ways to accomplish this.

I Use the Metadata API to read, analyze, edit and create/update reports.

I noticed that the field names (when specifying columns, filters, and groupings) which are returned when reading are not always the same names, and seem to depend upon Report Type.

Suppose I create a simple report on accounts, and I only return two columns, Account owner and Account Name.
1. If I chose standard system-generated "Accounts" report types when creating this report, then upon reading it in the metadata API the column names are

2. If I chose custom report type which I created manually, then the column names are (These seem to be the API names)
Account.Name, Account.Owner.Name

3. If I choose a system-generated report type where account is not the main object, for example "Activities with Account" I get the following column names:

This happens with other (not custom) columns as well. Maybe there are even more possible column names for the same column in different report types, I don't know...

How to know when to use which names? Also, Is there a way I read the other (besides API, option 2) column names programmatically? Can't find these names in the describe when using Partner or REST API.