• David Zhu
  • SMARTIE
  • 964 Points
  • Member since 2014

  • Chatter
    Feed
  • 26
    Best Answers
  • 1
    Likes Received
  • 11
    Likes Given
  • 10
    Questions
  • 239
    Replies
I have the following trigger on Contacts to send an email to one of our managers when a contact 'deactivated', however I don't know how to test the Messaging.SingleEmailMessage() code and my test covereage is not enough:

trigger InactiveNotificationTrigger on Contact (after update) {
    
    for (Contact c : Trigger.new){
        
        if(Trigger.oldMap.get(c.id).Record_Status__c == 'Active' && c.Record_Status__c == 'Inactive'){

            List<ID> ModID = New List<ID>();
            ModID.add(c.LastModifiedById);
            string FullEmailTxt;

            List<User> ModUser = [Select ID, name from user where ID in: ModID];
            for(integer i = 0 ; i < ModUser.size(); i++){
                string emailTxt1 = 'Dear Development and Communications Director, ';
                string emailtxt2 = 'The contact, '+c.FirstName+''+c.LastName+', has been marked inactive by '+ModUser[i].name+' on '+c.LastModifiedDate+'.'; 
                string emailTxt3 = 'To review the contact please follow the link: '+System.URL.getSalesforceBaseUrl().toExternalForm()+'/'+c.Id+'.'; 
                FullEmailTxt = emailTxt1+'\n'+'\n'+emailTxt2+'\n'+'\n'+emailTxt3+'\n'+'\n'+'Cheers!';
            }
            
    
            List<User> DevComMng = [Select ID, email from user where Title = 'DevComm Director'];
// for testing only List<User> DevComMng = [Select ID, email from user where Name = 'System Administrator'];
            for(integer i = 0 ; i < DevComMng.size(); i++){
                
                String[] toAddresses = new String[] {DevComMng[i].email};
                    
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                email.setToAddresses(toAddresses);
                email.setSenderDisplayName('Salesforce Administration');
                email.setSubject('Inactive Contact Allert');
                email.setBccSender(false);
                email.setPlainTextBody(FullEmailTxt);
                email.setSaveAsActivity(false);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
                
            }
            
            Note n = new note();
                n.ParentID = c.id; n.Title = 'Inactive Notification Sent'; n.body = FullEmailTxt;
            insert n;
        }
    }
}

Here the test code I have now:
@isTest
private class TestInactiveNotificationTrigger {

    @isTest static void TestInactiveNotificationTrigger() {
        // Test data setup
        // Create a Board Campaign and assign and insert a current and former board member
        Contact con = new Contact(FirstName='Test',LastName='Contact');
        insert con;
        
        con.Status__c = 'Inactive';
//        con.Inactive_Reason__c = 'Deceased';
        update con;

        // Verify 
        // In this case the inserted contact record should have been updated as GRE Volunteer by the trigger,
        // so verify that we got back an empty search.
        List<ID> nID = New List<ID>();
        nID.add(con.id);
            List<Note> n = [SELECT id FROM Note WHERE ParentID in : nID];
            System.assert( (n.size() == 0), 'Notification Trigger failed.');
        
    }
}
I'm not that familiar create test class yet.  Hope you guys can help me with this.  Can you guys help me?
 
trigger primaryContactOwnership on MRG_Ownership__c (after insert,after update) 
{
    ownerTrigger();
    
    public void ownerTrigger(){
    List<Id> primaryOwnershipIdList = new List<Id>();
    List<Id> relatedPropertyIdList = new List<Id>();

    for(MRG_Ownership__c ownership : Trigger.New)
    {
        if(ownership.Primary_Contact__c == true && (Trigger.Old == null || Trigger.OldMap.get(ownership.Id) == null 
        || Trigger.OldMap.get(ownership.Id).Primary_Contact__c != true)) // To handle null scenario
        {
            primaryOwnershipIdList.add(ownership.Id);
            relatedPropertyIdList.add(ownership.Property__c);
            
            Property__c property= [select id, Primary_Contact__c from Property__c WHERE id =:ownership.Property__c limit 1];
            property.Primary_Contact__c=ownership.contact__c;
            update property;
        }
    }

    List<MRG_Ownership__c> relatedOwnershipList = [Select Id, Primary_Contact__c 
                                                    From MRG_Ownership__c 
                                                    Where Property__c in :relatedPropertyIdList
                                                    And Primary_Contact__c = true
                                                    And Id Not in :primaryOwnershipIdList];

    if(relatedOwnershipList.size() > 0)
    {
        for(MRG_Ownership__c ownership : relatedOwnershipList)
            ownership.Primary_Contact__c = false;

        update relatedOwnershipList;
    }
    
    
    }
}

 
I have a text field with a date in it (Opt_Out_Date_txt__c), and I'm trying to put that date into a Date-type formula field (Opt_Out_Date_Formula__c). The text field is in MM/DD/YYYY format. Here's what I have:

IF(OR(NOT(ISNULL(Opt_Out_Date_txt__c)), NOT(ISBLANK(Opt_Out_Date_txt__c))), DATEVALUE(RIGHT(Opt_Out_Date_txt__c, 4)+'-'+ LEFT(Opt_Out_Date_txt__c,2)+'-'+RIGHT(LEFT(Opt_Out_Date_txt__c,5),2)), NULL)

This is working fine when the text field is populated, but when it's blank I'm getting a #Error! message in the field (the syntax saves fine).

Any ideas? Thank you!
Hi Experts,
Below is my trigger, I need test call for this trigger Plz help !

trigger OpenEventCount on Event (after insert, after update, after delete, after undelete) {
  
 List<Event> eventList = (Trigger.isInsert|| Trigger.isUnDelete) ? Trigger.new : Trigger.old;
  
     List<Id> eventIds = new List<Id>();
     for (Event evt : eventList) {
         eventIds.add(evt.WhatID);
     }
     
     List<Opportunity> oppList = [
             select
                 id,
                 (select id, WhatID from Events),
                  Open_Events__c,Total_Events__c
             from
                 Opportunity
             where
                 id in :eventIds];
  
     for (Opportunity opp : oppList) {
         Integer count = 0;
         for(Event evt : opp.Events)
          {
            if(evt.WhatId != null) 
            count += 1;
          }  
               
         opp.Total_Events__c = opp.Events.size();
         opp.Open_Events__c = count;
     }
     update oppList;    
  
 }
To give you some background, Contact is the parent object and Concept_Email__c is the child object. 

 I am trying to write a tirgger that would update the
The arctics ID which is named "Concept_email_Arctics_ID_MSE__c" on Concept_Email__c object when it is changed 

Below is the code snippet that I've started. Any help with fixing the trigger below will be appreciated.

As of now I am getting a syntactical error "Invalid field contact for sObject contact"

 
trigger UpdateArchticIDEmail on Contact (After Update) {
for(Contact cont: Trigger.New)
 {
 //Select Arctics ID from Contact__c object
 Contact ArchID=[select Archtics_ID__c from Contact where id=:cont.Contact];
 //Select Arctics ID from Concept_Email__c  object
 list<Concept_Email__c> cec=[select Concept_email_Arctics_ID_MSE__c from Concept_Email__c WHERE Contact=:cont.id];
 List<Concept_Email__c> listemail=new List<Concept_Email__c>();
 for(Concept_Email__c uid:cec)
 {
 //Assign Updated Details from Contact__c object to Concept_Email__c Object
 uid.Concept_email_Arctics_ID_MSE__c=ArchID.Archtics_ID__c;
 listemail.add(uid);
 }
 update listemail; 
 }
}

 
Hello,

I have exsisting Account and opportunities records.
They have Tasks related to it.

Task have record type TA, TB, TC

I want to replace all the TA related to Accounts with TB
and I want to replace all the TA related to opportunites with TC.
 
I am planning to run a code in Anonymous mode in Production, 

Thank you for advise.
  • September 08, 2015
  • Like
  • 0
I am trying to write a test case for my page/controller. I've written test code for triggers before without a lot of trouble, but it's been a long time and I am having trouble getting my tests written. Below is my code, as well as where I am with my test code so far.

The page/controller let's me add multiple entries for a custom object so I can enter a bunch at once and then save them.

Any help and direction is much appreciated.

Controller:
public class MultiAddSEActivities
{
    
    // Holds the SE Activity records to be saved
    public List<SE_Activities__c>recList  = new List<SE_Activities__c>();
    
    // List of the recClass
    public List<recClass> actRecords
    {get;set;}
    
    // Indicates the row to be deleted
    public String selectedRowIndex
    {get;set;}  
    
    // # of records in the recClass list
    public Integer count = 0;
    
    // Save the records by adding the elements in the record class list to recList, return to the same page
    public PageReference Save()
    {
        PageReference pr = new PageReference('/a00/o');
        
        for(Integer j = 0;j<actRecords.size();j++)
        {
            recList.add(actRecords[j].seact);
        } 
        insert recList;
        pr.setRedirect(True);
        return pr;
    }
        
    // Add a row
    public void Add()
    {   
        count = count+1;
 
        // Call to the recClass constructor
        recClass objRecClass = new recClass(count);
        
        // Add the record to the recClass list
        actRecords.add(objRecClass);
    }
    
    // Add duplicate of last row
    public void dupe()
    {
        if (count == 0){
            return;
        }else{
            
            // Create new Record Class record
            recClass dupeRecord = new recClass(count+1);
            
            // Get duplicate record from temp list
            dupeRecord.seact = actRecords[count-1].seact.clone(false,true,false,false);
            
            // Add the record to the record class list
            actRecords.add(dupeRecord);
            
            count = count + 1;
        }
    }
    
    // Delete row
    public void Del()
    {
        
        // Find the matching record in the list and remove it
        Integer j = 0;
        while (j < actRecords.size())
        {
          if(actRecords.get(j).recCount == selectedRowIndex)
          {
            actRecords.remove(j);
            count = count - 1;
          }
          else
          {
            j++;
          }
        }

        // Reset recCount for each record in the list
        Integer r = 0;
        while (r < actRecords.size())
        {
           actRecords[r].recCount = String.valueOf(r+1);
           r++;
        }     
    }
    
    
    // Constructor
    public MultiAddSEActivities()
    {
        //ApexPages.StandardController ctlr
        actRecords = new List<recClass>();
        Add();
        selectedRowIndex = '0';   
    }


    // Record Class
    public class recClass
    {       
        // recCount acts as a index for a row. This will be helpful to identify the row to be deleted
        public String recCount
        {get;set;}

        public SE_Activities__c seact 
        {get;set;}

        // Record Class Constructor
        public recClass(Integer intCount)
        {
            // Set the index
            recCount = String.valueOf(intCount);     
            
            // Create a new SE Activity
            seact = new SE_Activities__c();
            
        }
    }
}

Test Code:
@isTest
public class controllerTests {

    public static testMethod void testMultiAddSEActivitiesPage(){
    
        PageReference pg = Page.MultiAddSEActivities;
        Test.setCurrentPage(pg);
        
        MultiAddSEActivities controller = new MultiAddSEActivities();
        String nextPage = controller.Save().getUrl();

        // Instantiate a new controller with all params on the page
        controller = new MultiAddSEActivities();
        controller.Add();
        controller.dupe();
        controller.Del();
        
        public List<SE_Activities__c> testList  = new List<SE_Activities__c>();
        
        // ?????
        
        nextPage = controller.Save().getUrl();

    }
}

Page:
<apex:page controller="MultiAddSEActivities" id="thePage">
<apex:form >
<apex:pageblock id="pb" >
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Add}" rerender="pb1"/>
        <apex:commandbutton value="Duplicate Last" action="{!Dupe}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}"/>
    </apex:pageBlockButtons>
    
    <apex:pageblock id="pb1">
            
        <apex:repeat value="{!actRecords}" var="e1" id="therepeat">
             <apex:panelGrid columns="8">
                
                <apex:panelGrid headerClass="Name" width="15px">
                    <apex:facet name="header">Delete</apex:facet>
                    <apex:commandButton value="x" action="{!Del}" rerender="pb1">
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
                    </apex:commandButton>
                </apex:panelGrid>   

                <apex:panelGrid title="SPD">
                    <apex:facet name="header">Activity Date</apex:facet>
                    <apex:inputfield value="{!e1.seact.Activity_Date__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Opportunity</apex:facet>
                    <apex:inputfield style="width:250px" value="{!e1.seact.OpportunityLink__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Type</apex:facet>
                    <apex:inputfield value="{!e1.seact.Type__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Hours</apex:facet>
                    <apex:inputfield style="width:30px" value="{!e1.seact.Hours__c}"/>
                </apex:panelGrid>
                                
                <apex:panelGrid >
                    <apex:facet name="header">Comments</apex:facet>
                    <apex:inputfield style="width:250px; height:12px" value="{!e1.seact.Comments__c}"/>
                </apex:panelGrid>
                
                <apex:panelGrid >
                    <apex:facet name="header">Onsite</apex:facet>
                    <apex:inputfield value="{!e1.seact.Onsite__c}"/>
                </apex:panelGrid>
                
            </apex:panelgrid>
        </apex:repeat>
        
    </apex:pageBlock>        
</apex:pageblock>
</apex:form>
</apex:page>


 
Hey,

       I have created vf page , code is given below. page is working fine with the permission , but i need to give autor apex permission otherwise it isn't working. i cant give that to every profile and if i disable it than the page stops working. here is the code , what should i do?
 
<apex:page standardController="Project__c" sidebar="false" showHeader="false" extensions="ProjectTime_Controller" id="TimeTrack" standardStylesheets="false" docType="html-5.0">
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            <meta name="viewport" content="width=device-width, initial-scale=1"/>
            <meta name="description" content=""/>
            <meta name="author" content=""/>
    
            <title>Time Station</title>
    
            <!-- Bootstrap core CSS -->
            <apex:stylesheet value="{!URLFOR($Resource.Bootstrap3_3_2, '/bootstrap-3.3.2-dist/css/bootstrap.min.css')}" />
            <!-- Bootstrap theme -->
            <apex:stylesheet value="{!URLFOR($Resource.Bootstrap3_3_2, '/bootstrap-3.3.2-dist/css/bootstrap-theme.min.css')}" />
        </head>

        <body role="document">
            <div class="panel panel-default">
            <div class="panel-body">  
            <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Time Station</h3>
            </div>
            <div class="panel-body">

        <script>
            var pos = {};
            function success(position) {
              pos = position.coords;
              console.log(pos);
            }
            
            function error(msg) {
             console.log(msg);
            }
            
            if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(success, error);
            } else {
              error('not supported');
            }
            
            function setPos() {
                var inputs = document.getElementsByTagName('input');
                for(var x = 0; x < inputs.length; x++) {
                    if(inputs[x].id.indexOf('contactlat') >= 0) { inputs[x].value = pos.latitude; }
                    if(inputs[x].id.indexOf('contactlong') >= 0) { inputs[x].value = pos.longitude; }
                }
            }
                        
             if('{!showMessage}'=='True'){
                 alert('You Are not Logged In any project, so you can not switch project, please select a project and Punch In to log time');
             }
            
        </script>
        
        <apex:form >
        <apex:pageBlock rendered="{!AcitivityStatus}">
        <div class="alert alert-info">
        <center><b>Your Are Currently Logged in "{!sObjName}" </b></center>
        </div>
       
        </apex:pageBlock>
            <center><apex:commandButton action="{!Back}" value="Select Project To Log Time" rendered="{!disablepro}" styleClass="btn btn-lg btn-primary" /></center> <!--style="height:45px;width:230px;font-size:15px;" -->
            <center><apex:commandButton action="{!P_Out_Main}" value="Punch Out" onclick="setPos();" rendered="{!AcitivityStatus}" styleClass="btn btn-lg btn-primary"/></center><br/><br/> <!--style="height:40px;width:180px;font-size:15px;"-->
            <center><apex:commandButton action="{!actionDo}" value="Switch Project" rendered="{!AcitivityStatus}" styleClass="btn btn-lg btn-primary"/></center>
            <apex:inputhidden value="{!valuelat}" id="contactlat"/> 
            <apex:inputhidden value="{!valuelong}" id="contactlong" />
         </apex:form>
     </div>
     </div>
     </div>
     </div>
     </body>
     </html>
</apex:page>

 
Hi All,

 I have used apex InputSecret tag in vf page. And assigned object field value, even its showing null value.

<apex:inputSecret value="{!inputValue}" id="theSecretInput"/>

value="" is null one I have open the vf page in browser. 

Please help this issue.

Kind Regards,
Mohan
  • August 25, 2015
  • Like
  • 0
Why am I getting a Variable does not exist error for line 13: m4a[x].counter = counter + 1;
 
public class Mix4 {

    integer counter = 0;
    
    public static void main(){
        integer count = 0;
        
        Mix4 [] m4a = new Mix4[20];
        integer x = 0;
        
        while(x < 9){
            m4a[x] = new Mix4();
            m4a[x].counter = counter + 1;
            count = count + 1;
            count = count + m4a[x].maybeNew(x);
            x = x+1;
            
        }
        system.debug(count + ' ' + m4a[1].counter);
        
    }   
    
    public integer maybeNew(integer index){
        
        if(index < 1){
            Mix4 m4 = new Mix4();
            m4.counter = m4.counter + 1;
            return 1;
        }
        return 0;
    }
    
}

 
global class RecurringScheduleJob{
    public static void startJob(){
        String str = 'Job Started at : ' + system.now();
    }
}
I was writing test class for this class but as it is static , i am not allowed to to call static method.

any suggestions ?
  • March 30, 2015
  • Like
  • 0
trigger Update  on Opportunity(afterupdate){

     List<Service__c lstservice=new List<Service__c>();

     Map<id,Opportunity> oppMap=new Map<Id,Opportunity>();

     for(Opportunity  opp:Trigger.new){

       oppMap.put(opp.Id,opp);

    }

     if(Trigger.isUpdate){

       for(Opportunity opp :Trigger.new){

          oppMap.put(opp.Id,opp);
        }

        List<Service__c> serList=[SELECTService_Type__c,Service_location__c FROM Service__c WHEREopppID  IN:oppMap.keySet()];

         List<Service__c> serviceListToUpdate=newList<Service__c>();

        for(Service__c ser:serList){

             ser.Service_Type__c=oppMap.get(ser.Id).Service_Type__c;

           ser.Service_location__c=oppMap.get(ser.Id).Service_location__c

             serviceListToUpdate.add(ser);

         }

        if(serviceListToUpdate.size()>0){

             try{

               update serviceListToUpdate;

             }catch(DmlException de){

                System.debug(de);

             }

        }

     


 
I am wanting to ensure a user fills out a Win/Loss section when the Opporunity Stage is Closed Won or Closed Lost with the following Validation Rule. It isn't working and since this is my first try at a validation rule, I'm not sure why. Any help would be appreciated.

( ISPICKVAL( Workflow_Stage__c , "Closed Won")  || ISPICKVAL( Workflow_Stage__c , "Closed Lost") ) && ( ISPICKVAL( Reason__c , "") ||  ISPICKVAL(  Result__c  , "") || ISBLANK(  W_L_Competitors__c ) ||   ISBLANK(W_L_Notes__c) )

Hi. 
I want to replace some specific words in string with anothers using pattern and matcher. Example: I want format nicely SOQL query so:
[ SELECT Id, Name FROM Account WHERE Name =  'John' ]
should be changed to:
[SELECT
    Id, Name
FROM
    Account
WHERE 
    Name = 'John']

The code:
 

String convertInput = '[ SELECT Id, Name FROM Account WHERE Name =  \'John\' ]';
String convertOutput = '';
String regExp = '(SELECT|FROM|WHERE)';

Pattern p = Pattern.compile(regExp);      
Matcher m = p.matcher(convertInput);
    while (m.find() == true) {          
        convertOutput = m.replaceFirst('\n' + m.group(1) + '\n');

    } 
System.debug(convertOutput);

Gives error: System.LimitException: Regex too complicated

Where code:
String convertInput = '[ SELECT Id, Name FROM Account WHERE Name =  \'John\' ]';
String convertOutput = '';
String regExp = '(SELECT|FROM|WHERE)';

Pattern p = Pattern.compile(regExp);      
Matcher m = p.matcher(convertInput);
    while (m.find() == true) {          
        convertOutput = m.replaceAll('\n' + m.group(1) + '\n');
    } 
System.debug(convertOutput);

Gives output:
SELECT
Id, Name
SELECT
Account
SELECT
Name = 'John' ]

So I am confused what is so complicated in replaceFirst?
Do you have any suggestions how to solve that?
Hello,

i created a workflow rule, in which i add a time based rule. Suppose after 30 days.

But i want to execute this trigger after each 30 days.  But in present condition, it is checked only once.

Any workaround for this usecase ?
  • March 23, 2015
  • Like
  • 0
Hi all
How to get the number of records in  a particular date range.
For example i am having object called orderline.i want to get number of records were created during 12-jan-2014 to 12-dec-2014.
Currently am using force.com explorer so i need a query to get the expected result.

Thanks
All,
I'm trying to create a field that totals all the completed events on a contact page. I think I'm on the right track, but I'm not sure how to go about making the event an integer, then sum all of them. This will eventually be a batch job that just runs every morning, but I have to get the class right first obviously. Any help would be great! Here's my code thus far:
public class TotalCompletedEvents {
    //Grab list of contacts
    protected final Contact[] contactNewList = new Contact[] {};
    protected final Contact[] contactOldList = new Contact[] {};
        
    public TotalCompletedEvents(Contact[] contactOldList, Contact[] contactNewList) {
        this.contactNewList.addAll(contactNewList == null ? new Contact[] {} : contactNewList);
        this.contactOldList.addAll(contactOldList == null ? new Contact[] {} : contactOldList);
    }
    public void execute() {
        // Find all events associated to contacts
        Event[] eventList = [select ActivityDate, WhoId, EndDateTime, Subject, ActivityDateTime from Event where WhoId in :contactNewList];
        Map<Id, Contact> contactMap = new Map<Id, Contact>(contactNewList);
        for(Contact contact : contactNewList) {
            contact.Total_Completed_Events__c = null;
        }
        for(Event event : eventList) {
            Contact contact = contactMap.get(event.WhoId);
            if(Contact == null)
                continue;
            if(Event.EndDateTime < Date.Today())
                Contact.Total_Completed_Events__c += Event.EndDateTime;
        }
    }
}


 
I understand that an object can have two Master-Detail Relationships.  I currently have a custom object with 1 Master-Detail and 1 Lookup Relationship.  I would like to convert the Lookup to a Master Detail Realtionship.  When testing in sandbox, I am receiving the message that a master-detail already exists.

Has anyone had this scenario and if so, how to work around?

Thanks in Advance!
Hi,
 I have the following code in my controller.
----------------------------------------------------
 Pattern findMethodPattern = Pattern.compile('/\bSREV_[a-zA-Z0-9]+Handler[.]([a-zA-Z0-9]+)(?=)/gi');
 string str = 'SREV_TaskHandler.TaskBeforeUpdate(Trigger.new , Trigger.old);';
 Matcher tgrBodyMatter = findMethodPattern.matcher(str);
 system.debug('>>>'+ tgrBodyMatter.matches());//is always false.
----------------------------------------------------
 From the above code, the tgrBodyMatter.matches() should return true and with a value "TaskBeforeUpdate" but it is always false. if I use the same input and expression is working fine on https://regex101.com/r/oJ8xL2/1
Please guide.

 
I had a phone interview last week for Salesforce Developer position. It lasted about 30 minutes for about 20 questions. I don't think I passed the interview as I have not received in-person interview notification.
Anyways, I would say some questions are challenging to me, they are very good and worth to take a look. Can someone please help me find the best answer/solutions?
 
 
1. how would you do if you need to print all contacts in name card format? similar to the name card when we attend Salesforce World Tour.
 
2. Custom object Training__c is a master detail relationship with Contact object. Room__c is the field of Training__c object. Each contact will link to  multiple Training records. Different training might be the same training room with different training date.
   How to create a report with Contact names and the distinct training room in a given date range?  Cannot use Summary Report.
 
3. How would you setup to meet the following requirement for custom object xxxxx?
   a. all users can see all records in xxxxxx.
   b. executive users can delete any record in xxxxxx
   c. marketing users can NOT delete records in xxxxx if type (a custom field, not record type) is 'Closed'
 
4. How to prevent recursive trigger except using static Boolean variable?
   what is the con of using static Boolean variable to avoid recursive trigger?
 
 
5.Flow trigger gets SOQL limit exceeding error. what could be the problem?
 
6.What rules do you follow to design a trigger?
 
7.When creating a new task, how to list all other tasks related to the same contact?
  I said to add a VF page with Task controller extension to Task Layout. But when I look at the Task Page layout, there is no way to add VF page.
 
8. Two scenarios for selecting different parent-child relationship. (master-detail or lookup) Questions are pretty long, it took more than one minute for them to read the questions.
   I want to know if there is guide about when to use different relationship.
 
5.Flow trigger gets SOQL limit exceeding error. what could be the problem?
 
6.What rules do you follow to design a trigger?
 
7.When creating a new task, how to list all other tasks related to the same contact?
  I said to add a VF page with Task controller extension to Task Layout. But when I look at the Task Page layout, there is no way to add VF page.
 
8. Two scenarios for selecting different parent-child relationship. (master-detail or lookup) Questions are pretty long, it took more than one minute for them to read the questions.
   I want to know if there is guide about when to use different relationship.

Thanks,
David
I have a custom object and I want to replace Delete, Edit, New, and View actions content source with VF page.
I want to use the same VF page but display differnt section for different action.

Is there a way to tell which action is invoked in Apex?

thanks,
David
Even though according to SFDC policy, it is NOT allowed to discuss the assignment. But I have to ask this question.

I have finished my assignment and submitted on Monday 7th following the instructions by changing the email address of the cerfi. admin user and checking 'generate new password and notify user immediately'.

But my org is still available and no email notification was sent to me for the  confirmation. I have opened a case to salesforce yesterday and did not get anything back since. (it is weired because SFDC usually replies questions responsively).

Just want to know what is a normal time frame for confirmation. I want to do the essay exam asap. I don't want to wait too long since my vacation is coming.

Thanks,
David
I have difficulty to center outputpanel component in a cell. It keeps left alighed. Please advise.

 
<tr>
        <td id = "tcen" colspan="3">
            
            <apex:outputPanel layout="block"  id ="p1">
                <apex:datatable value="{!ZeroSaleProducts}" var="sales" columns="1" rendered="{!(DateSelectionError = false)}">
                <apex:column >
                    <hr/><apex:outputtext value="{!sales.name}" styleClass="productTextStyle"/>
                </apex:column>
                </apex:datatable>
            </apex:outputPanel>
            
        </td>
    </tr>

 
I have difficulty to center outputpanel component in a cell. It keeps left alighed. Please advise.
<tr>
        <td id = "tcen" colspan="3">
            
            <apex:outputPanel layout="block"  id ="p1">
                <apex:datatable value="{!ZeroSaleProducts}" var="sales" columns="1" rendered="{!(DateSelectionError = false)}">
                <apex:column >
                    <hr/><apex:outputtext value="{!sales.name}" styleClass="productTextStyle"/>
                </apex:column>
                </apex:datatable>
            </apex:outputPanel>
            
        </td>
    </tr>
My org has a package called "REST Explain Client" installed by consulting firm who setup the org. The guy who installed the package left the firm and nobody knows the package.
We are in the process of cleaning up our org. This package seems not referenced anywhere else, we can unstall it from sandbox org without any problem. But we still want to make sure.

Is there a way to determine it is (or not) referenced?

Thanks,
David
 
Hi,
I have a custom object (called AccountRequest__c) used for maintaining requests of accounts. A custom button is created on Account object page.
When user clicks the button, it brings to a page to create a new record on AccountRequest__c. I used the following Query String to pass some values of Account to AccountRequest__c.  

/a00/e?retURL=%2Fa00%2Fo&RecordType=012J00000005KEr&ent=01IJ0000000Afbg&00NJ0000001taui={!Account.SAPAccountNumber__c}&00NJ0000001wk5R={!Account.SAPAccountNumber__c}

Correspondingly, 00NJ0000001taui is for field SAP_number__c on AccountRequest__c and 00NJ0000001wk5R is for field SAP_number_hidden__c.

If I add both SAP_nubmer__c and SAP__number_hidden__c on AccountRequest__c page layout, values are passed as expected. No issue at all.

But If I only add SAP_number__c to page layout. It seems SAP_number_hidden__c has no value passed to. I confirmed this by using validation rule at saving the record.

I ensure the field level security is visible to all profiles and NOT readonly. 

Can some one give me a hand? 

thanks,
David

 
Hi All,
We are testing SSO with ADFS. We follow the instruction from this link.
https://developer.salesforce.com/page/Single_Sign-On_with_Force.com_and_Microsoft_Active_Directory_Federation_Services

For IDP-Iniated login, it works as expected.  All logins from company computers are successful.

But SP-Initiated login fails. I use this as our SP login url  https://apotex--SSO.cs22.my.salesforce.com. I expect it redirecting to IDP login url automatically.
User-added image
But it never redirects. Just sitting as normal login with SSO. I tried using my user name and password and it gets the following error:

Your company's Single Sign-On configuration is invalid. Please contact the administrator at your company for more information.

Can someon please give me a hand?

Thanks,
David



 
Hi,
I came across a weired scenario.
I have a custom formula field on User object. It is called "users division". The formula is below:
 
CASE(  upper(LEFT( Profile.Name , 2)),
            "US", "Corp",
            "SY", "GIS",
            "ET", "GIS",
            "AC", "ACP",
            "Other")
Basically, it takes the first two letters from the profile. for example, if the user profile is "System administrator", the custom field value should be "GIS" in user information. 
It works as expected in the user information.

BUT, if I create a report using "Users" report. and add my custom field to the columns. The value shows as "Other" for all "system administrators".
It means the formula calculate using different value of the profile name for system admins.
Intrestingly, users with other profile name (non standard profile) have the correct value.

User-added image

User-added image

Thanks,
David
Hi All,
I am practicing SOAP API call using Enterprise WSDL in a Windows application on .NET 3.5. The code is very simple:

            JumpStart.WSDL.SoapClient loginClient = new SoapClient();
            try
            {
                loginClient.login(null, username, password);
            }
            catch (System.Exception e)
            {
                ......
            }
 
 It keeps getting the following error and I am not sure what to check.  
I also have app.config file pasted below.


Thanks,
David

================================
There was no endpoint listening at https://test.salesforce.com/services/Soap/c/32.0 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Server stack trace: 
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
=======================================
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="SoapBinding">
                    <security mode="Transport" />
                </binding>
                <binding name="SoapBinding1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://test.salesforce.com/services/Soap/c/32.0"
                binding="basicHttpBinding" bindingConfiguration="SoapBinding"
                contract="JumpStart.WSDL.Soap" name="Soap" />
        </client>
    </system.serviceModel>
</configuration>
I have a custom object and I want to replace Delete, Edit, New, and View actions content source with VF page.
I want to use the same VF page but display differnt section for different action.

Is there a way to tell which action is invoked in Apex?

thanks,
David
I have got a pageblock table with all parents records and all of them has a lineitem button linked to it, now the requirement is to display child records in the same pageblock table under the particular parent recordwhen this button is clicked.Both parent and child belongs to same object and they have self relationship.Thanks in advance
I use Workbench to run some SOQL queries to get data from my ContentDocument table. My first query simply lists all the records: 
"Select Id, Title from ContentDocument"
The number of records matchs what's returned by the SOQL API. However, if I select to include "Deleted and Archived Records" from the console, I see a couple more data. I am new to SFDC so this is a bit strange for me. But that wasn't the strangest part - the strangest part is by accident I ran into some DocumentIDs that were NOT included in the table, but if I search for them specifically, Workbench returns them! 

"Select Id, Title from ContentDocument where Id=<foo>"

I double-checked several times, using Title and ID so it's not my eyes. Plus there are more than 1 records missing.

So I have 2 questions: 
1> What do I need in my SOQL query to get everything from the table? I will only use API for production 
2> Why do I not see some records with a statement that should return everything (I come from vanilla SQL camp)?










 

 
Hi, is there any custom coding that can remove "on behalf of user@yourdomain.com" from the Salesforce alerts and reports email headers? Our email gateway blocks all emails that says mydomain.com generated from other domains. Salesforce admin settings cannot change this and couldnt find a feasible solution.  
hi, i have a scenario

please help me out

i want to change opportunity owner name based on another object field name. 
Example:

In opportunity i have a picklist list field that is realated to custom object. if i select a record in custom object in the custom record name become the opportunity field record name.

here the problem i have to work with three objects one opportunity, custom object and user object.

can any one help to solve this issue
I have the following trigger on Contacts to send an email to one of our managers when a contact 'deactivated', however I don't know how to test the Messaging.SingleEmailMessage() code and my test covereage is not enough:

trigger InactiveNotificationTrigger on Contact (after update) {
    
    for (Contact c : Trigger.new){
        
        if(Trigger.oldMap.get(c.id).Record_Status__c == 'Active' && c.Record_Status__c == 'Inactive'){

            List<ID> ModID = New List<ID>();
            ModID.add(c.LastModifiedById);
            string FullEmailTxt;

            List<User> ModUser = [Select ID, name from user where ID in: ModID];
            for(integer i = 0 ; i < ModUser.size(); i++){
                string emailTxt1 = 'Dear Development and Communications Director, ';
                string emailtxt2 = 'The contact, '+c.FirstName+''+c.LastName+', has been marked inactive by '+ModUser[i].name+' on '+c.LastModifiedDate+'.'; 
                string emailTxt3 = 'To review the contact please follow the link: '+System.URL.getSalesforceBaseUrl().toExternalForm()+'/'+c.Id+'.'; 
                FullEmailTxt = emailTxt1+'\n'+'\n'+emailTxt2+'\n'+'\n'+emailTxt3+'\n'+'\n'+'Cheers!';
            }
            
    
            List<User> DevComMng = [Select ID, email from user where Title = 'DevComm Director'];
// for testing only List<User> DevComMng = [Select ID, email from user where Name = 'System Administrator'];
            for(integer i = 0 ; i < DevComMng.size(); i++){
                
                String[] toAddresses = new String[] {DevComMng[i].email};
                    
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                email.setToAddresses(toAddresses);
                email.setSenderDisplayName('Salesforce Administration');
                email.setSubject('Inactive Contact Allert');
                email.setBccSender(false);
                email.setPlainTextBody(FullEmailTxt);
                email.setSaveAsActivity(false);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
                
            }
            
            Note n = new note();
                n.ParentID = c.id; n.Title = 'Inactive Notification Sent'; n.body = FullEmailTxt;
            insert n;
        }
    }
}

Here the test code I have now:
@isTest
private class TestInactiveNotificationTrigger {

    @isTest static void TestInactiveNotificationTrigger() {
        // Test data setup
        // Create a Board Campaign and assign and insert a current and former board member
        Contact con = new Contact(FirstName='Test',LastName='Contact');
        insert con;
        
        con.Status__c = 'Inactive';
//        con.Inactive_Reason__c = 'Deceased';
        update con;

        // Verify 
        // In this case the inserted contact record should have been updated as GRE Volunteer by the trigger,
        // so verify that we got back an empty search.
        List<ID> nID = New List<ID>();
        nID.add(con.id);
            List<Note> n = [SELECT id FROM Note WHERE ParentID in : nID];
            System.assert( (n.size() == 0), 'Notification Trigger failed.');
        
    }
}
I'm not that familiar create test class yet.  Hope you guys can help me with this.  Can you guys help me?
 
trigger primaryContactOwnership on MRG_Ownership__c (after insert,after update) 
{
    ownerTrigger();
    
    public void ownerTrigger(){
    List<Id> primaryOwnershipIdList = new List<Id>();
    List<Id> relatedPropertyIdList = new List<Id>();

    for(MRG_Ownership__c ownership : Trigger.New)
    {
        if(ownership.Primary_Contact__c == true && (Trigger.Old == null || Trigger.OldMap.get(ownership.Id) == null 
        || Trigger.OldMap.get(ownership.Id).Primary_Contact__c != true)) // To handle null scenario
        {
            primaryOwnershipIdList.add(ownership.Id);
            relatedPropertyIdList.add(ownership.Property__c);
            
            Property__c property= [select id, Primary_Contact__c from Property__c WHERE id =:ownership.Property__c limit 1];
            property.Primary_Contact__c=ownership.contact__c;
            update property;
        }
    }

    List<MRG_Ownership__c> relatedOwnershipList = [Select Id, Primary_Contact__c 
                                                    From MRG_Ownership__c 
                                                    Where Property__c in :relatedPropertyIdList
                                                    And Primary_Contact__c = true
                                                    And Id Not in :primaryOwnershipIdList];

    if(relatedOwnershipList.size() > 0)
    {
        for(MRG_Ownership__c ownership : relatedOwnershipList)
            ownership.Primary_Contact__c = false;

        update relatedOwnershipList;
    }
    
    
    }
}

 
Hi guys,
I have one requirments .Responsible object and contains status and response fields are there.
When the status is equal to accepted or not accepted then i want to give edit access to the user for response field.
How it is possible please help me.
Hi, I have the requirement: 2 tabs from Contacts: 1 of the tab is "Interlocutor" (spanish) and the another one is "Candidatos" both of them from contacts module.
I renamed the contacts for Interlocutor tab.
And for Candidatos one I created a new Tab (from contacts and through Visualforce: with follow code: <apex:enhancedList type="Contact" />)
What I need to do now is to filter the records for all the organization for each tab, I mean, as the origyn of the entire information is contact, i need to sepparate the data for each tab. If the user clicks on "Interlocutor" the system should filter "Automatically" the data from Contact with type = "Interlocutor"; and if the user clicks on the "Candidatos" the system should do the same but for contact type = "Candidato"
I guess this sould be done through visualforce in Candidatos tab, but I dont know how can I do this.
But for the Interlocutor tab, I have no idea! 
Can somebody help me on this subject? Please!!!!
Thanks!
Karelia.-
Is it possiblle to have set up trigger using REST API, when when condition meets, salesforce will callback to my service?
We are creating a service that will notify user when certain data in salesforce changed, the other option, not ideal, is we can have a worker that periodically poll the data to check the changes.
I created a custom field (formula) in order products and need to use it in the calculation formula for a rollup type field in order.
the only fields available in the list of available fields to aggregate are quantity, list price and unit price. Is there a way to access that custom field ?
I have a text field with a date in it (Opt_Out_Date_txt__c), and I'm trying to put that date into a Date-type formula field (Opt_Out_Date_Formula__c). The text field is in MM/DD/YYYY format. Here's what I have:

IF(OR(NOT(ISNULL(Opt_Out_Date_txt__c)), NOT(ISBLANK(Opt_Out_Date_txt__c))), DATEVALUE(RIGHT(Opt_Out_Date_txt__c, 4)+'-'+ LEFT(Opt_Out_Date_txt__c,2)+'-'+RIGHT(LEFT(Opt_Out_Date_txt__c,5),2)), NULL)

This is working fine when the text field is populated, but when it's blank I'm getting a #Error! message in the field (the syntax saves fine).

Any ideas? Thank you!
Hi everyone,

Im trying to generate table of all campaign members with their names and addresses, render as pdf (or html or whatever) but with fixed number of rows and columns per page. The idea is that I need this table to be printed on paper with stickers that could be used on envelopes and sent to those members.
I added custom button on Campaign layout generating the pdf, but Im struggling with the code (Im really no coder btw:). See below code, what I just started but got stuck, this only generates cells in one row... I just used Account and Email fields instead of address otherwise it is same. Could please somebody tell me how to modify to make grid 3x10 fixed? Many thanks

<apex:page standardController="Campaign" showHeader="false" renderAs="pdf" applyBodyTag="false">
  <span style="font-family: Arial Unicode MS">
     <table border="0" width="100%" id="table4">
           <apex:repeat value="{!Campaign.CampaignMembers}" var="line">         
           <td>{!line.Contact.Name}<br/>{!line.Contact.Account}<br/>{!line.Contact.Email}<br/></td>            
        </apex:repeat> 
    </table> 
  </span>  
</apex:page>
Hi every body,

I have followed this steps "https://developer.salesforce.com/page/Force.com_IDE_Installation" to intalled the Eclipes and create project, but i got htis error. Why?

Here is error screenshot:
User-added image
Hi,
 
 Wrote a below trigger after insert and after update for some reasons its not firing please suggest me what might be the issue. 
 
trigger territory_lookup on Lead (After Insert, After Update) 
{
  Try 
  {
 set<id> gid = new set<id>();
 Set<String> gzip = new Set<String>();
 Set<String> gstate = new Set<String>();
 Set<String> gcountry = new Set<String>();
 
 Integer intzip;

 lead ld = [select id,postalcode,state,country from lead where id = :Trigger.newMap.keySet() limit 1];

 intzip=Integer.valueof(ld.postalcode);

  system.debug(intzip);
 
 String ldstate;
 String ldcountry;
 
  ldstate = ld.state;
  ldcountry = ld.country;
  Territory_Lookup__c tl = [select Theater__c,Region__c,Area__c,User__c FROM Territory_Lookup__c
                           where Zip_Start__c <= :intzip and Zip_End__c >= :intzip and
                                 State__c in :gstate and Country__c in :gcountry limit 1];
                                

  list<lead> led = [select id,postalcode,state,country from lead where id = :Trigger.newMap.keySet() limit 1];
 
  for(lead uld : led)
  {
   uld.Territory_Area__c = tl.Area__c;
   uld.Territory_Region__c = tl.Region__c;
   uld.Territory_Theater__c = tl.Theater__c;
   }

  update led;

 }  
     
  catch(Exception ex){
  system.debug(ex);

  
  }    

}

Thanks
Sudhir
I have below these four fileds.
Morning_Sign_In__c
Afternoon_Sign_Off__c
Afternoon_Sign_In__c
Evening_Sign_Off__c

When the employee morning sign in and afternoon sign off for lunch break and after lunch login and evening logout. in between this situation i need calculate the total working hours of the day in 12 hours format
I am using a custom New button in an object to launch a Visualforce page - which then launches a Flow. I would like to capture the Record ID of that record which I am in when I press the button and save the ID to a variable I can use within the Flow which gets launched.

How can I do this ?
  • November 06, 2015
  • Like
  • 1
Hi,

I translated tabs, labels and custom fields in french on the sandbox.
I created Outbound Change Sets and add 'language translation' component in french.
I uploaded in production but the translation doesn't work.
Thanks in advance for your help.
Sébastien.
Hi,

I have a simple requirement. I'm loading data into one of my objects in salesforce from an external system. I want to send an email when the bulk insert gets completed. The email should contain the following information:

1. A guarantee that the insert is complete and no more records are remaining to be inserted.
2. The count of records that were inserted type wise. e.g count of Type A records inserted, count of Type B records inserted, etc

The information available with me is following:

1. The start time of the insert job at external system.
2. Full access to the salesforce object on which data is being inserted.

What is the most elegant and scalable solution for this requirement? Please help me figure this out. 
Using some examples I have come up with the following Visualforce page on our accounts.  I have a few issue with it that I need some help on.
  1. The page is cut off at the bottom when added to the Account Details page.
  2. Clicking the Save button in the page does save the inputField changes but it tries to display the entire Salesforce.com window in the Apex page.
  3. Is there a way to only display this based on a checkbox being checked?
<apex:page standardController="Account" showHeader="true">
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="name1" id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="Contact Penetration" name="name1" id="tabOne">
               <apex:pageBlock >
                  <apex:pageBlockSection columns="3">
                    <apex:outputField value="{!account.Architect_Contacts__c}"/>
                    <apex:outputField value="{!account.Design_Contacts__c}"/>
                    <apex:outputField value="{!account.Total_Contacts__c}"/>
                    <apex:outputField value="{!account.Architects_Engaged_6_Months__c}"/>
                    <apex:outputField value="{!account.Designers_Engaged_6_Months__c}"/>
                    <apex:outputField value="{!account.Total_Engaged_6_Months__c}"/>
                    <apex:outputField value="{!account.Architect_Penetration__c}"/>
                    <apex:outputField value="{!account.Design_Penetration__c}"/>
                    <apex:outputField value="{!account.Total_Penetration__c}"/>
                 </apex:pageBlockSection>
              </apex:pageBlock>
        </apex:tab>
        <apex:tab label="Specification Share of Wallet" name="name2" id="tabTwo">
            <apex:form >
               <apex:pageBlock >
               <apex:pageBlockButtons >
               <apex:commandButton action="{!save}" value="Save" immediate="true"/>
               </apex:pageBlockButtons>
                  <apex:pageBlockSection columns="2">
                    <apex:inputField value="{!account.Total_Annual_Specifications_Number__c}"/>
                    <apex:inputField value="{!account.Total_Annual_Specifications_Sales__c}"/>
                    <apex:inputField value="{!account.Koroseal_Specs_TTM_Number__c}"/>
                    <apex:inputField value="{!account.Koroseal_Specs_TTM_Sales__c}"/>
                    <apex:outputField value="{!account.Share_of_Wallet_Number__c}"/>
                    <apex:outputField value="{!account.Share_of_Wallet_Sales__c}"/>
                 </apex:pageBlockSection>
              </apex:pageBlock>
           </apex:form>
        </apex:tab>
        <apex:tab label="Specification Win Rate" name="name3" id="tabThree">
            <apex:form >
               <apex:pageBlock >
               <apex:pageBlockButtons >
               <apex:commandButton action="{!save}" value="Save" immediate="true"/>
               </apex:pageBlockButtons>
                  <apex:pageBlockSection columns="1">
                    <apex:outputField value="{!account.Koroseal_Specs_TTM__c}"/>
                    <apex:inputField value="{!account.Specifications_Won__c}"/>
                    <apex:inputField value="{!account.Specifications_Lost__c}"/>
                    <apex:outputField value="{!account.Specification_Win_Rate__c}"/>
                 </apex:pageBlockSection>
              </apex:pageBlock>
           </apex:form>
        </apex:tab>
    </apex:tabPanel>
</apex:page>
Thanks in advance!
 
All - I created a wizard in visual force on a page called opptyStep1. I then assigned this page as the homepage on my site. 
Here's the issue: the preview screen of the page looks perfect but when I click on the site, two of the fields are not showing correctly: one is supposed to be a dropdown menu (Investment Strategy), the other a checkbox (active__c). The check box doesnt even show.  Any ideas?  The code is below

<apex:page sidebar="false" standardstylesheets="false" showheader="false" controller="newOpportunityController"
           tabStyle="Opportunity">
           <apex:image value="http://i723.photobucket.com/albums/ww231/sumtuck1/la-investments-v2-intrlcd-nav_zpsumlix1ia.png"/>
 <apex:sectionHeader title="Step 1 of 3: Personal Information"
                     />
  <apex:form >
    <apex:pageBlock title="Open a NSRi Account">

      <!-- This facet tag defines the "Next" button that appears
           in the footer of the pageBlock. It calls the step2()
           controller method, which returns a pageReference to
           the next step of the wizard. -->  
    
      <apex:facet name="footer">
        <apex:commandButton action="{!step2}" value="Next"
                            styleClass="btn"/>
      </apex:facet>
    

      <!-- <apex:panelGrid> tags organize data in the same way as
            a table. It places all child elements in successive cells,
            in left-to-right, top-to-bottom order -->  
    
      <!-- <apex:outputLabel > and <apex:inputField > tags can be
            bound together with the for and id attribute values,
            respectively. -->  
    
      
     
    
       <apex:panelGrid columns="2">
         <apex:outputLabel value="First Name"
                           for="contactFirstName"/>
         <apex:inputField id="contactFirstName"
                          value="{!contact.firstName}"/>
         <apex:outputLabel value="Last Name" for="contactLastName"/>
         <apex:inputField id="contactLastName"
                          value="{!contact.lastName}"/>
         <apex:outputLabel value="Phone" for="contactPhone"/>
         <apex:inputField id="contactPhone"
                          value="{!contact.phone}"/>
           <apex:outputLabel value="Email"
                           for="accountPersonEmail"/>
          <apex:inputField id="accountPersonEmail"
                          value="{!account.personEmail}"/>
         <apex:outputLabel value="Date of Birth"
                           for="contactBirthdate"/>
          <apex:inputField id="contactBirthdate"
                          value="{!contact.birthdate}"/>
          <apex:outputLabel value="Social Security Number"
                           for="contactSocial_Security_Tax_ID__c"/>
          <apex:inputField id="contactSocial_Security_Tax_ID__c"
                          value="{!contact.Social_Security_Tax_ID__c}"/>
                           <apex:outputLabel value="Investment Strategy"
                            for="opportunityInvestment_Strategy__c"/>
          <apex:inputField id="opportunityInvestment_Strategy__c"
                           value="{!opportunity.Investment_Strategy__c}"/>
          <apex:outputLabel value="Initial Investment Amount"
                            for="opportunityAmount"/>
          <apex:inputField id="opportunityAmount"
                           value="{!opportunity.amount}"/>
          <apex:outputLabel value=""
                            for="opportunityActive__c"/>
          <apex:inputField id="opportunityActive__c"
                           value="{!opportunity.Active__c}"/>
                         
        
       </apex:panelGrid>
 
    </apex:pageBlock>
  </apex:form>
</apex:page>
 
HI Guys,

We are using  partner communities . So if the User login  by entering the credentials and when user logouts i need to perform some action. this is fine. But when user closes the window directly i need to perform same action which performs while logout. Please let me know how to detect the window close event and perform the actions in apex class . 


please advise us.

Thanks
Shiva.
Hi,

I am using a class
public class EventBookingRecs
{
        public sObject EventBooking {get; set;}
        public Account bookingAccount {get;set;}
        public Contact bookingContact {get;set;}
}
where variable EventBooking is based on custom object EventBooking already created. The custom object has fields like Name, Status__c etc. I am using EventBooking in visualforce page -> pageblocktable.
example
<apex:pageblocktable value="{!EventBookingRecords}" var="ebrecs" id="pbt">
       <apex:Column >
              <apex:facet name="header">Booking Status</apex:facet>
                    <apex:selectList id="status" onchange="saveValues({!ebrecs.index})" value="{!ebrecs.EventBooking['Status__c']}" size="1">
                        <apex:selectOption itemValue="" itemLabel=""/>
                        <apex:selectOption itemValue="Attended" itemLabel="Attended"/>
                        <apex:selectOption itemValue="No Show" itemLabel="No Show"/>
                    </apex:selectList>
       </apex:Column>
</apex:pageblocktable>

Could you please let me know how to write a getter and setter method for EventBooking['Status__c'] (EventBookingRecs.EventBooking.Status__c) so that when values changes on screen it should set it permamently and screen refresh should not affect it?

Please let me know if you need more details

Best Regards,

Rahul
Hi All,

I am in need of some code snipet where i will be displaying a calender in vf page (Not Full page calender) and need to display all the events by week, month and the same will be displayed in mobile.

Regards
 
I need a little assistance with APEX triggers, I have created a request and email approvals and I am trying to get the request to appear on a shared calendar in yellow and change to green or red when approved or denied. Does anyone have any APEX training that they could assist me with. This is my first APEX project.Thanks in advance, Brandi
If interested, post your contact information here.

Must be able to be set up as a vendor and be paid by a US company.
Hi.

In the VF I used the date format as YYYY-MM-dd in the 
<apex:outputText value="{0,date,YYYY/MM/dd}">
Before the last week of the year it was OK. When the new year falls in the  last week of Decemeber comes the issue.
For example
2014:
S   M  T  W Th F Sat
28 29 30 31 1   2 3

In the above calendar 1st Jan of 2015 falls in the Thurusday.So when I viewd the records of 28,29,30 of December 2014 It showed as
2015-12-28
2015-12-29
2015-12-30
2015-12-31

After that I came to know that
@"YYYY" is week-based calendar year.
@"yyyy" is ordinary calendar year.
http://realmacsoftware.com/blog/working-with-date-and-time

cheers
suresh