• CyberJus
  • NEWBIE
  • 375 Points
  • Member since 2012


  • Chatter
    Feed
  • 12
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 55
    Replies
Hi, 
I am not able to complete Trailhead:Bulk Apex Triggers challenge ,I am facing  issue ' Challenge not yet complete... here's what's wrong: 
                                               Executing against the trigger does not work as expected'.  Debug logs are also not descriptive like error message.

Code :

trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {

    List<Task> tasks = new List<Task>();
     
    for (Opportunity opp: Trigger.New) {
        If (Trigger.isUpdate){
        if(opp.StageName!=trigger.oldMap.get(opp.Id).stageName && opp.StageName == 'Closed Won'){
            tasks.add(new Task(Subject = 'Follow Up Test Task',WhatId = opp.Id)) ;
        }
    } 
   
    If (Trigger.isInsert){
        if(opp.StageName == 'Closed Won'){
            tasks.add(new Task(Subject = 'Follow Up Test Task',WhatId = opp.Id)) ;
        } 
    } 
}    
    if (tasks.size()< 0){
        insert tasks;
    }
}
I have no workflow,flow or powerbuilder process related to opportunity.

P.S.
I have followed suggestion of other users (Chris Edwards and Sandeep Bhanot) which they have posted  in a similar post but in my case this issue is not fixed.
 
Hi Experts,

I need some assitance with a date formula. I trying to calculate the number of months left between two dates, start and end date. I currently have the folloiwng formula:

(Custom_End_Date__c - today ())/30

Which will give me the number of days left and if I divide the number by 30 and I should get the numbner of months. Unfortunately I am short by one month. For example if I have a end date of 12/01/2015 minus today, 30 July, would give me 124 days. If I divide that by 30 I get 4 months, or more exactly 4.13 months. But from July to Dec is 5 months.

Any assistance would be greatly appreciated.

Thank-you
Why does this work:

AND(NOT(ISPICKVAL( LeadSource , "Live Chat")) , NOT( $UserRole.Id = "00E70000001A1gy" ), ISBLANK( Phone ) )

But this doesn't (no syntax errors are thrown):

AND( OR(NOT( ISPICKVAL( LeadSource , "Live Chat")),NOT( ISPICKVAL( LeadSource , "Offline Message"))) ,  NOT( $UserRole.Id = "00E70000001A1gy"  ), ISBLANK( Phone )   )

How do I make the rule function so I can include mutlople lead source values?
Chatter information is different between Community and internal contexts. is there a way for the same chatter experience for internal employee regardless of whether they log in via AGS360(one of our community) or the internal salesforce experience?
Any suggestions would be great help.Thank you.
<apex:page  renderAs="pdf" action="{!modifyUnitPrice}" contenttype="UTF-8">

    <head>
      <style type="text/arial" media="print">    
           @media print{
                table {page-break-inside:auto}
                tr    { page-break-inside:avoid; page-break-after:auto;page-break-before:auto }
                thead { display:table-header-group }
            }
            @page {
                margin: 75px 16px 75px 16px;Padding-top:30px;
                @PageBreak{
                   page-break:always;
                    page-break-inside:avoid;
                } 

                @top-center {
                    content: element(header);
                }
                @bottom-center {
                    content: element(footer);
                }
            } 
            .tableStyle{
                width: 100%;
                -fs-table-paginate: paginate;
            }
            @media print{          
                thead
                {
                    display:  table-header-group;   
                }
            }
            div.header{   
                padding-top:60px;              
                position: running(header);           
            } 
            div.footer {
                position : running(footer) ;
            }
            .pagenumber:before {                
                content: counter(page);             
            }                       
            .pagecount:before {             
                content: counter(pages);            
            } 
            #tc{           
                border:1px  solid black ;
            } 
            #tt{
                border:none ;
            }   
            .hideTd {
                display: none;
            }
            .fontChange {
                font-size:17px;
                line-hieght:2px;
            }
            .none {border-top:none;}
            .ftd{
                max-width:5%;
                min-wdith:5%;
            }
            .std{
                max-width:15%;
            }
            .ttd{
                max-width :20%;
            }
            .fotd{
                max-width:20%;
            }
            .table{
                border :2px solid black;
                border-collapse:collapse;
            }
            .tbl_main {
                font-size: 12px;
                border-bottom: 1px solid #000;
                border-left: 1px solid #000;
                page-break-inside:avoid;
                table-layout: fixed;
            }
            .tdCustom {
                border-top: 1px solid #000;
                border-right: 1px solid #000;
                text-align: center;
                height : 30pt;
                word-wrap: break-word; 
            }
            .tdCustom1 {
                border-top: 1px solid #000;
                border-right: 1px solid #000;
                text-align: center;
                height : 70pt;
                //width:15%
               // word-wrap: break-word; 
            }
            .rBorder {
                border-right: 1px solid #000;
            }
            .headTable {
                border: 1px solid #000;
                padding: 10px;
            }
            .table1 {
                border: 1px solid #000;
                border-bottom: none;
            }
            .btmBrdr {
                border-bottom: 1px solid #000;
            }
        </style>                 
    </head>
    <div class="header">   
        <div>  
             <table width="100%" height = "100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="50%" align="left"> 
                        <img style="WIDTH:200px; HEIGHT: 50px;padding-left:5px" src='{!URLFOR($Resource.NicomaticLogo)}' title="logo" />
                    </td> 
                    <td width="50%" align="right" style="padding-right:5px">
                        <b>QUOTATION:<apex:outputField value="{!Quote__c.Quote_Number_New__c}"/></b>
                    </td>  
                </tr>
             </table> 
        </div> 
    </div>
    <div class="footer"> 
        <div >
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-top:solid; border-color:#EBEBEB;">
                <tr>           
                    <td align="center">
                        <apex:outputText value="Page " style="font-face:verdana;font-size:0.68em;"/>
                        <span class="pagenumber" style="font-face:verdana;font-size:0.68em;"/> 
                        <apex:outputText value="of" style="font-face:verdana;font-size:0.68em;padding-left:2px;padding-right:2px"/> 
                        <span class="pagecount" style="font-face:verdana;font-size:0.68em;"/>
                    </td>
                </tr>         
            </table>
        </div>      
    </div>
</apex:page>
This is code working on previous salesforce.com api version 27.0

but it is not working on salesforce.com api version 33.0 .

I want to use version 33.0 how to fix this header and footer any alternate way there.
Hi all!

I'm very green at coding and need help with the validation rule in the Creating Validation Rules module. I am lost, i don't know where to start with coding it. Help!

Peter
Hello, 

I am trying to create a page where I can dynamically group querry results, and am using the code in this blog post as a template: template (http://blog.jeffdouglas.com/2011/03/02/dynamically-group-display-query-results/)

The difference is that I am trying to do this with a custom object instead of a standard object. 

Here is my controller: 
 
public with sharing class DisplaySectionsController {

    public List<PI_Vendor__c> vendors {get;set;}
    public String[] states {get;set;}

    public void load() {
    
    vendors = [Select ID, Name, State__c from PI_Vendor__c WHERE State__c IN ('DE','PA','MD')];
    
    Set<String> stateSet = new Set<String>();
    for (PI_Vendor__c v : vendors)
        stateSet.add(v.State__c);
        
    states = new String[stateSet.size()];
    Integer i = 0;
    for (String state : stateSet) {
        states[i] = state;
        i++;
        }
       }
      }

and here is my vf page: 
 
<apex:page controller="DisplaySectionsController" action="{!load}" sidebar="false">  
  <apex:sectionHeader title="My Sample Display Page" subtitle="Group by States" 
    description="This page shows how you can dynamically group results by field value."/>

  <apex:repeat value="{!states}" var="state">

    <apex:pageBlock title="{!state}">

      <apex:repeat value="{!vendors}" var="vnd"> 

        <apex:outputPanel rendered="{!IF(state=vendors.State__c,true,false)}">
        {!vnd.Name} - {!vnd.State__c}<br/>
        </apex:outputPanel>

      </apex:repeat>

    </apex:pageBlock>

  </apex:repeat>

</apex:page>

but I am getting the following error: 
 
Error: Unknown property 'VisualforceArrayList.State__c'

What can I do to make this work with a custom object?  And more importantly, where am I currently going wrong? 

Thanks in advance!

John
 
Hi, i have a problem about regex, i spend lots of time on it but still didn't solve it. please any one can answer my question.

this is my part of code:
 try{
    String myPlainText= 'Order Number: 2000157 Date Ordered: Wednesday, May 21, 2014 City: Auckland, 2241 State/Province: North Island, New Zealand Phone: 021735562';
  
      Pattern p=Pattern.compile('(?=:)*\\d{7}'); 

      Matcher m = p.matcher(myPlainText);
      if(m.matches())
      {
        system.debug(m.group(1));          
      }      
      // New orderRecord object to be created - set CustomerEmail__c and OrderNumber__c to
      OrderRecord__c record = new OrderRecord__c(CustomerEmail__c = email.fromAddress, CustomerName__c='NINI',
        OrderNumber__c =Integer.valueOf(m.group(1)));

 insert record;  


problems: i use this code to try to extract some data from email, but failed lots of time.
I wanna use regex to extract 2000157 which is order number. but i think my regex are incorrect, so could you help me to fix it? and i can't get value of m.group(1);     
  • April 16, 2015
  • Like
  • 0

 

Hello, 

I am trying to create a visualforce page that displays all of the current User's Opportunities. I would like to include Opportunities that they own AND all Opportunities where they are a member of the OpportunityTEam. 

My first attempt was to do a query like this:

MyOpTeam =[SELECT id, Record_Type_Name__c,  Name, StageName, Amount,  Owner.Id FROM Opportunity WHERE id IN (SELECT OpportunityId FROM OpportunityTeamMember WHERE (UserId=:UserInfo.getUserId() )OR (Opportunity.OwnerId=:UserInfo.getUserId())];  
*** PROBLEM: this only pulled opportunities that had team members. Any opportunities that I owned that did not have a team member record were excluded. 

Could anyone look at my current code and tell me how I can go about getting these two SEPARATE queries into one list? 
public class Oppsownerteam {
public Oppsownerteam(ApexPages.StandardController controller) {
        
}
    
 Id Mouse = Userinfo.getUserId();
 public List<Opportunity> MyOwnedOpps;
 public List<Opportunity> MyTEamOpps;
 

            Public Integer Get MyOwnedOpps()
               {
                  MyOwnedOpps =[SELECT id, Record_Type_Name__c,  Name, StageName, Amount,  Owner.Id FROM Opportunity WHERE ownerid =:Mouse];  
                return   MyOwnedOpps;       
                }
            

             Public List<Opportunity> GetMyTEamOpps()
               {                        
                MyTEamOpps =[SELECT id, Record_Type_Name__c,  Name, StageName, Amount,  Owner.Id FROM Opportunity WHERE id IN (SELECT OpportunityId FROM OpportunityTeamMember WHERE UserId=:Mouse)];  
                   
                return MyTEamOpps;                               
                 }
            
  



}

 
Hi Masters,

I am new to Salesforce.

At the moment, I am trying to create a trigger.
In the code, there is one picklist in my lead, and then there is another exact same picklist in my task. When ther is log a call or new task coming in. The task's picklist value will be default to same as the lead's picklist value automacally.

However, the trigger that I created is not running. Is there anything wrong with what I did? Or I just made it too complicated?

Here is my trigger,
Trigger PrePopulateTaskPromoCode on Task (before insert) {
        
    List<Lead> leadsToUpdate = new List<Lead>();
    List<Task> tasks = new List<Task>();
    
    for (Task t : trigger.new) {
        if (String.valueOf(t.WhoId).substring(0,3) == '00Q') {
            Lead leadToLookup = [Select promo_code__c FROM Lead WHERE Id = :t.WhoId];
            String promoCode = leadToLookup.Promo_Code__c;
            t.Promo_Code__c = promoCode;
            tasks.add(t);
  
        }
    }
   // update tasks;
}


 
Im new to coding and would like help in referencing a cell in accounts for google gauges. see my code below...

also....i wont to build a standalone dashbord for my office screen. how do i reference or get numbers from a report for the guages. or how do i reference a scecific account without placing the vf page in the account to make a dashboard? 

sorry to be so dumb...just learning as is fun stuff to work with...
thanks to all who help out...muchly appreciated...

Bryn

<apex:page standardcontroller="Account" sidebar="false" showHeader="false" >

<apex:sectionHeader title="FRS GROUP DASHBOARD"/>
<font size="20"  color="darkblue" > <center> <b> FRS </b> </center> </font>
<html>
  <head>
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
    <script type='text/javascript'>
      google.load('visualization', '1', {packages:['gauge']});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['Memory', value = "!cash__c"],
         
        ]);
          var data2 = new google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['nemory', 90],
         
        ]);
         var data3 = new google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['oemory', 100],
         
        ]);

        var options = {
          width: 400, height: 120,
          redFrom: 90, redTo: 100,
          yellowFrom:75, yellowTo: 90,
          minorTicks: 5, max: 120
        };
       
        var options2 = {
          width: 400, height: 120,
          redFrom: 90, redTo: 100,
          yellowFrom:75, yellowTo: 90,
          minorTicks: 5, max: 130
        };
       
        var options3 = {
          width: 400, height: 120,
          redFrom: 90, redTo: 100,
          yellowFrom:75, yellowTo: 90,
          minorTicks: 5, max: <apex:outputText value="{!DAY(TODAY()) *10}" />
        };

        var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
        chart.draw(data, options);
        var chart2 = new google.visualization.Gauge(document.getElementById('chart_div2'));
        chart2.draw(data2, options2);
        var chart3 = new google.visualization.Gauge(document.getElementById('chart_div3'));
        chart3.draw(data3, options3);
      }
    </script>
  </head>
  <body>
    <div id='chart_div' ></div>  
    <div id='chart_div2'></div>   
    <div id='chart_div3'></div>
   
    <div id='visualization' style="width: 1500px; height: 700px  "></div>
  </body>
</html>
</apex:page>
i have 2 record types for Reservation__c: Rent & Reserve

if i select Rent, i want to get the url. how can i call it from an apex class?
PageReference gotomain = new PageReference('what is the url here?') ;
  • January 03, 2014
  • Like
  • 0
Hi,

I have see how you can interact through javascript with the standard publisher by accessing the its canvas app in the documentation for custom publisher actions. Is refreshing the feed the only publish event that is available? Is there documenation for this standard canvas app somewhere?

Example: 
<script>
        function refreshFeed() {
            Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {feed:true}});
        }
    </script>

Found here:
http://help.salesforce.com/apex/HTViewHelpDoc?id=creating_vf_pages_for_custom_actions.htm&language=en_US
I know I can access the object labels like {!$ObjectType.Case.LabelPlural}  However, I want to also access the standard translations for the actions such as List, New, Edit. The output should be "Cases List" or "New Case" like you would see in the standard pages. Right now I have the label and just hardcoded the words "New" or "List" on the output. 

The purpose of this is custom visualforce pages in a community where I need to use translations.  I would rather not use custom labels for these because I know the standard translations have to be in there somewhere.  Any idea where I can access these?
Hi, 

I have made my cases object private and have a custom visualforce page and controller to retrieve a list of cases.

On the standard page, a user can only see those cases they have read permissions on.

On the visualforce page, the query also retrieves cases where the case contact is also from the same account. However, the user does not actually have permission to these cases, and gets a permission error when they try to access it. 

Just for my own sanity, when you run a query it should only retrieve those objects which you have at least permission to, correct? It has been working like this for everything else I can remember. 

Is there something weird with case sharing and customer portal licenses?

I am using overage customer portal licenses in a community.  

Hi, 

 

I am trying to deploy from sandbox to production, and every object is showing up in the "Add" section. Looking at the IDE Log viewer it looks like I am getting a "Deploy to retrieve" ServiceException: UNKNOWN_EXCEPTION. I created a case with SFDC support, just waiting to hear back. Here is the partial stack trace:

 

WARN [2013-03-04 09:05:16,102] (BasePackageService.java:waitForResult:144) - Deploy or retrieve operation to 'https://na9-api.salesforce.com/services/Soap/m/26.0/xxxx' failed: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
WARN [2013-03-04 09:05:16,112] (PackageRetrieveService.java:retrieveWork:1062) - Unable to retrieve components: ServiceException: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
WARN [2013-03-04 09:05:16,124] (DeploymentController.java:generateDeploymentPayload:335) - Unable to retrieve remote components for resources
com.salesforce.ide.core.services.ServiceException: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
at com.salesforce.ide.core.services.BasePackageService.waitForResult(BasePackageService.java:151)
at com.salesforce.ide.core.services.PackageRetrieveService.getRetrieveResult(PackageRetrieveService.java:941)
at com.salesforce.ide.core.services.PackageRetrieveService.retrieveWork(PackageRetrieveService.java:1053)
at com.salesforce.ide.core.services.PackageRetrieveService.retrieveWork(PackageRetrieveService.java:1006)
at com.salesforce.ide.core.services.PackageRetrieveService.retrievePackage(PackageRetrieveService.java:319)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.handleSourceRetrieve(DeploymentController.java:462)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.loadRemoteProjectPackageList(DeploymentController.java:425)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.generateDeploymentPayload(DeploymentController.java:333)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.generateDeploymentPayload(DeploymentController.java:251)
at com.salesforce.ide.deployment.ui.wizards.DeploymentPlanPage$1.run(DeploymentPlanPage.java:141)

 

Anyone else having issues with this, and/or know what might be causing it?

I am getting an internal server error in my Spring 12 Sandbox for all of my existing flows designed with the old flow designer tool. Is any else experiencing this? 

Hi,

I have see how you can interact through javascript with the standard publisher by accessing the its canvas app in the documentation for custom publisher actions. Is refreshing the feed the only publish event that is available? Is there documenation for this standard canvas app somewhere?

Example: 
<script>
        function refreshFeed() {
            Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {feed:true}});
        }
    </script>

Found here:
http://help.salesforce.com/apex/HTViewHelpDoc?id=creating_vf_pages_for_custom_actions.htm&language=en_US
Hi,

We have a custom object which have 4 record types, each link to their own pagelayout, but when user try to create a new record, always record type are always saved as one type not the type user selected earlier. I have check the user profile, all 4 record types are available for them. what could cause it?
Hi, 
I am not able to complete Trailhead:Bulk Apex Triggers challenge ,I am facing  issue ' Challenge not yet complete... here's what's wrong: 
                                               Executing against the trigger does not work as expected'.  Debug logs are also not descriptive like error message.

Code :

trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {

    List<Task> tasks = new List<Task>();
     
    for (Opportunity opp: Trigger.New) {
        If (Trigger.isUpdate){
        if(opp.StageName!=trigger.oldMap.get(opp.Id).stageName && opp.StageName == 'Closed Won'){
            tasks.add(new Task(Subject = 'Follow Up Test Task',WhatId = opp.Id)) ;
        }
    } 
   
    If (Trigger.isInsert){
        if(opp.StageName == 'Closed Won'){
            tasks.add(new Task(Subject = 'Follow Up Test Task',WhatId = opp.Id)) ;
        } 
    } 
}    
    if (tasks.size()< 0){
        insert tasks;
    }
}
I have no workflow,flow or powerbuilder process related to opportunity.

P.S.
I have followed suggestion of other users (Chris Edwards and Sandeep Bhanot) which they have posted  in a similar post but in my case this issue is not fixed.
 
What's the difference between the Admin Trail, and Admin CRM. This CRM looks as if it is a new module, which in my personal opinion contains content that could be referenced in the CRM basics module. Can anyone shed any light on this?

Thank you,
Dannielle
Hi Experts,

I need some assitance with a date formula. I trying to calculate the number of months left between two dates, start and end date. I currently have the folloiwng formula:

(Custom_End_Date__c - today ())/30

Which will give me the number of days left and if I divide the number by 30 and I should get the numbner of months. Unfortunately I am short by one month. For example if I have a end date of 12/01/2015 minus today, 30 July, would give me 124 days. If I divide that by 30 I get 4 months, or more exactly 4.13 months. But from July to Dec is 5 months.

Any assistance would be greatly appreciated.

Thank-you
Hi,
I often get asked a simple question but very hard to answer is ,what are the challenges you faced in sfdc development part ie referring to Apex classes,controllers,extensions,triggers and its related Visual force pages etc, i am new to sfdc,hence not enough experienced to give a convincing answer,i just would like to programatically work and experience the tasks,
If anyone have sometime to share your personal experiences, if possible with a short discription or code that is realted to your acheived task will be highly appreciated.
It is very urgent,
I have to Update a custom field on User object,requiremnt is when one user contains 10 account records, then this 10 should be display on user custom field. so how to achive this ?
for example: account, acount contain 100 records on same account owner. then this 100 sholud be display on that User custom field for reporting purpose. 


Thanks In Advance
Hi Guys,
Can you please help me out with this Trigger?
Whenever any record is created or edited on kugo2p__SalesOrder__c then it should copy kugo2p__BillingFrequency__c field value to other Custom Object I have kugo2p__SalesOrderServiceLine__c and the field name is Billing_Frequency__c. kugo2p__SalesOrderServiceLine__c is the Child of kugo2p__SalesOrder__c. 
Also this Trigger should only update field when on kugo2p__SalesOrder__c we have Order_Form_Type__c = New Order OR Upsell – Independent OR Upsell – Coterminous OR Organic Growth OR Credit OR Renewal OR Renewal – Entitlement Reconciliation OR New – Entitlement Reconciliation OR Upsell – Entitlement Reconciliation
  • July 30, 2015
  • Like
  • 0
In my production organization I am facing Apex SOQL limit exception (too many soql queries 101). I tried lot of ways but not able to resolve it. Now I want to use Oracle cloud or other PaaS platform to replace SOQL with the data returned by REST or SOAP . Trying to impleatment this logic:-
Step 1)  Use metadata api to send all salesforce data to other platform
Step 2)  Use REST/SOAP to get all the data from third party(Oracle Cloud/Heroku).
Step 3)  Replace SOQL with this data.

I really have no idea how to start this.... any suggestion or help ?? 

 
I'm trying to insert two object records, but I'm getting an error because the 2nd object list doesn't see the 1st object id yet and I'm getting a "Missing Required Field validation error". Is there a way I can time, or chain these so they are both inserted with the correct relationship.
 
public StoreFront2(){
        ct=new Purchase_Line_Items__c();
        ct2=new Contact();
        flag = false;
        flip = false;
        flag2 = true; 
      
    }
      
    public PageReference buy(){
        
        List<Merchandise__c> toMerch = new List<Merchandise__c>();
        
        List<id> updateMerch = new List<id>();
                
        PageReference send = new PageReference('/apex/StoreCart2');
        
        if(ct != null && cart !=null ){
            List<DisplayMerchandise> counter = new List<DisplayMerchandise>();
    		List<Merchandise_Line_Item__c> merchi = new List<Merchandise_Line_Item__c>();
            Decimal total = 0;
            counter = cart.values();
            
            for(Integer i = 0; i < counter.size();i++){
                Decimal totalPrice = counter.get(i).count;
                total +=totalPrice;
                ct.Item_Quantity__c=total;
                system.debug(ct);
          		merchi.add(new Merchandise_Line_Item__c(Name ='Pencils',Purchases__c=ct.id, Merchandise_Item_Stable__c='a02F000000AuhTh'));
              
            }	
         	insert ct;
            insert merchi;

 
//EmailAddress is known, the  List of  address i want to send email.

String dn =  'My_Template_Name';
        
        Id tid;
        tid = [select id from EmailTemplate where developername =:dn ][0].id;   
           
        for(String saddr : EmailAddress ){
           
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            string [] toaddress= New string[]{saddr};
            email.setTemplateId(tid);
            email.setSubject('Attendance_System_Exception_Records_Alert');
            email.setPlainTextBody('Testing Apex Scheduler-Body');
            email.setToAddresses(toaddress);
            Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
        }
Is there some problem with my code?
the schedule job give me a ERROR:

System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing targetObjectId with template: []

If you can help me , please.
 
Why does this work:

AND(NOT(ISPICKVAL( LeadSource , "Live Chat")) , NOT( $UserRole.Id = "00E70000001A1gy" ), ISBLANK( Phone ) )

But this doesn't (no syntax errors are thrown):

AND( OR(NOT( ISPICKVAL( LeadSource , "Live Chat")),NOT( ISPICKVAL( LeadSource , "Offline Message"))) ,  NOT( $UserRole.Id = "00E70000001A1gy"  ), ISBLANK( Phone )   )

How do I make the rule function so I can include mutlople lead source values?
Hi,

Good day to you all.

I wanted to check if Custom Settings are considered as part of 10 Custom objects creation limits for "Force.com - App Subscription" or custom setting in not counted under that limit. Please let me know about it. 

Thanks

Scratching my head--works fine in the UI, but not via data loader. Any suggestions?

GIST: Check to see if company name is in another table, OR in some other conditions (basic if then) flag a field as true on lead. Nothing complex. Why is Data Loader skipping it?

trigger LeadAssignmentRuleTest on Lead (before insert) {
  for (Lead a : Trigger.new) {
      List<Inside_View_Company__c> b= [select id, Account_Name__c from Inside_View_Company__c where Account_Name__c = :a.Company LIMIT 1];
     

    if(!b.isEmpty() || a.Event_Temperature__c=='Hot'|| a.Event_Temperature__c=='Warm') {
          a.Direct_to_Sales__c=True;
    }
    if(!String.isblank(a.Form_Name__c)){
          if(a.Form_Name__c.containsIgnoreCase('buy') || a.Form_Name__c.containsIgnoreCase('inquiry')){
		  a.Direct_to_Sales__c=True; 												
          }
	}
 }
}
Hi All,

Can any one help me my search was not working properly

Controller:
public with sharing class ContactSearchController {
    // the soql without the order and limit
  private String soql {get;set;}
  // the collection of contacts to display
  public List<Contact> contacts {get;set;}
  // the current sort direction. defaults to asc
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
    set;
  }
  // the current field to sort by. defaults to last name
  public String sortField {
    get  { if (sortField == null) {sortField = 'lastName'; } return sortField;  }
    set;
  }
  // format the soql for display on the visualforce page
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20'; }
    set;
  }
  // init the controller and display some sample data when the page loads
  public ContactSearchController() {
    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    runQuery();
  }
  // toggles the sorting of query from asc<-->desc
  public void toggleSort() {
    // simply toggle the direction
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
    // run the query again
    runQuery();
  }
  // runs the actual query
  public void runQuery() {

    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20');
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Ooops!'));
    }

  }
  // runs the search with parameters passed via Javascript
  public PageReference runSearch() {

    String name = Apexpages.currentPage().getParameters().get('name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where name != null';
    
    if (!name.equals(''))
    soql += ' and name LIKE \''+String.escapeSingleQuotes(name)+'%\'';
    if (!AccountName.equals(''))
    soql += ' and Account.Name LIKE \''+String.escapeSingleQuotes(AccountName)+'%\'';
    if (!email.equals(''))
    soql += ' and Email LIKE \''+String.escapeSingleQuotes(email)+'%\'';
    if (!city.equals(''))
    soql += ' and OtherCity LIKE \''+String.escapeSingleQuotes(city)+'%\'';
    if (!state.equals(''))
    soql += ' and OtherState LIKE \''+String.escapeSingleQuotes(state)+'%\'';
    if (!country.equals(''))
    soql += ' and OtherCountry LIKE \''+String.escapeSingleQuotes(country)+'%\'';
    if (!phone.equals(''))
    soql += ' and Phone LIKE \''+String.escapeSingleQuotes(phone)+'%\'';

    // run the query again
    runQuery();
    
    return null;
  }
  // runs the search with parameters passed via Javascript
 /* public PageReference runSearch() {

    String Name = Apexpages.currentPage().getParameters().get('Name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    if (!Name.equals(''))
      soql += ' and name LIKE ''+String.escapeSingleQuotes(Name)+'%'';
    
    if (!accountName.equals(''))
      soql += ' and account.name LIKE ''+String.escapeSingleQuotes(accountName)+'%'';
      if (!email.equals(''))
      soql += ' and email LIKE ''+String.escapeSingleQuotes(email)+'%'';
      if (!city.equals(''))
      soql += ' and city LIKE ''+String.escapeSingleQuotes(city)+'%'';  
      if (!state.equals(''))
      soql += ' and state LIKE ''+String.escapeSingleQuotes(state)+'%'';
      if (!country.equals(''))
      soql += ' and country LIKE ''+String.escapeSingleQuotes(country)+'%'';
      if (!phone.equals(''))
      soql += ' and phone LIKE ''+String.escapeSingleQuotes(phone)+'%'';

    // run the query again
    runQuery();

    return null;
  }*/
}

Visualforce Page:
 
<apex:page controller="ContactSearchController" sidebar="false">

  <apex:form >
  <apex:pageMessages id="errors" />

  <apex:pageBlock title="Contact Search" mode="edit">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("accountName").value,
          document.getElementById("email").value,
          document.getElementById("city").value,
          document.getElementById("State").value,
          document.getElementById("Country").value,
          document.getElementById("phone").value
          );
      }
      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="Name" value="" />
          <apex:param name="accountName" value="" />
          <apex:param name="email" value="" />
          <apex:param name="city" value="" />
          <apex:param name="state" value="" />
          <apex:param name="country" value="" />
          <apex:param name="phone" value="" />
      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Office Name<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Email<br/>
        <input type="text" id="email" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">City<br/>
        <input type="text" id="city" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">State<br/>
        <input type="text" id="state" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Country<br/>
        <input type="text" id="country" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Phone<br/>
        <input type="text" id="phone" onkeyup="doSearch();"/>
        </td>
      </tr>
      </table>

      </apex:pageBlock>

    </td>
    <td valign="top">

    <apex:pageBlock mode="edit" id="results">

        <apex:pageBlockTable value="{!contacts}" var="contact">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Name}"/>
            </apex:column>

            <!--<apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>-->

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Office Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Email" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Email" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Email}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="City" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="City" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCity}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="State" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="State" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherState}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Country" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OtherCountry" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCountry}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Phone" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Phone" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Phone}"/>
            </apex:column>

        </apex:pageBlockTable>

    </apex:pageBlock>

    </td>
  </tr>
  </table>

  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    

  </apex:pageBlock>

  </apex:form>

</apex:page>

Thanks in Advance
Chatter information is different between Community and internal contexts. is there a way for the same chatter experience for internal employee regardless of whether they log in via AGS360(one of our community) or the internal salesforce experience?
Any suggestions would be great help.Thank you.
We have unused code and objects in production. We want to delete them to free up space but also want to archieve what we delete. I have installed the Force.com IDE and plan to make a zip for the .object files and the .cls files. Then we would store the zip on bitbucket / github. What is the best way to open a .object file to show exactly what it shows me in the Force.com IDE? Or would I just have to reload it into the Force.com IDE to look at it?

Thanks!
Hi Trailheaders!  Has anyone completed the Challenge for the "Automated Time-Based Actions with Workflow" section.

I am getting this reason: The 'Set Case to Escalated' Workflow field update action was not found

It states in the Challenge: NOTE: Since Workflow rules only fire on record save, normally you would implement this with a time-triggered workflow action...so I created it as a Time-Based action.

User-added image

Has anyone completed this Challenge successfully?