• Himanshu Parashar
  • PRO
  • 4544 Points
  • Member since 2011
  • Salesforce Architect


  • Chatter
    Feed
  • 124
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 809
    Replies
Hello, I have written a trigger that autmatically creates a Task record when a custom object record is created. The Owner of the Task is located through a string of related lookups. Currently, the trigger works, but it is not bulkified. I have attempted to bulkify the trigger, but I got lost is the logic and I could not find a similar piece of sample code to reference. Can someone point me in the right direction or give me some guidance.
 
trigger AutoCreateTask on Investigation__c (after insert) {

  List<Task> tasks = new List<Task>();

    for (Investigation__c newInv: Trigger.New) {

      Investigation__c investigation = [Select Id, RecordType.Name, Driver__c, Employee__c from Investigation__c where Id =: newInv.Id];


                
        if (investigation.RecordType.Name == 'Auto Investigation') {   
          Contact driver = [select Supervisor__c FROM Contact where Id =: investigation.Driver__c];
          Tasks.add(new Task( OwnerId = driver.Supervisor__c,
                              WhatId  = newInv.Id,
                              Subject = 'Please complete driver investigaiton',
                              ActivityDate = System.today().addDays(14),
                              Type = 'Investigation'
                              ));
        }

        if (investigation.RecordType.Name == 'Injury Investigations') {   
          Contact employee = [select Supervisor__c FROM Contact where Id =: investigation.Employee__c];
          Tasks.add(new Task( OwnerId = employee.Supervisor__c,
                              WhatId  = newInv.Id,
                              Subject = 'Please complete injury investigaiton',
                              ActivityDate = System.today().addDays(2),
                              Type = 'Investigation'
                              ));
        }    
    }    
  insert tasks;      
}

 
Hi,

I have a date time field that when I display in visualforce doesn't always show the correct date.  If the time I enter is 4:00 PM or later it displays the next days date.

My company time and user times are both PST (GMT + 8)
 
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}"> <apex:param value="{!v.tasting.Date_of_Tasting_Start__c}" />

Any ideas?
 
Hi there!
I have a lot of Projects, huge Projects ...
And creating Change Set for deploy with browsing within hundreds of items (filtered too!) taking a lot of time ..
If SF team could change default sort order (or pre-define/set it in own User Detail page) for "Add to Change Set" page something like:
  •  Sort by LastModifiedById Desc (with Current User)
  • "All LastModifiedById Desc (with Current User) within 3,7 last days" (for example)
it would be a huge improvement for saving time! 

P.S. I don't know where I need to put such request to SF .. and if it in wrong place feel free to remove/re-place it ...
 
  • December 08, 2015
  • Like
  • 0
Hello,

What is Lightning desing system in simple terms
  • December 08, 2015
  • Like
  • 0
Hello,

I see the new trailhead for "Lightning design system", I went throght it,

I wanted to know if someone has personally used it and what are its advantages other thatn good looks 
  • December 08, 2015
  • Like
  • 0
Hello
This is my first post.

I have a json string which I want to deserialize and get the values.

public class CompanyContactsWrapper
{
     public string contact{get;set;}
     public string postalcode{get;set;}
     public string contactnumber{get;set;}
}

public class Jsonexample4
{
   public CompanyContactsWrapper CompanyContacts{get;set;}
   
   public Jsonexample4()
   {
    
     string jsonInput='{"CompanyContacts":[{"contact":"pn0","postalcode":"0","contactnumber":"pc0"},{"contact":"pn1","postalcode":"1","contactnumber":"pc1"},{"contact":"pn2","postalcode":"2","contactnumber":"pc2"}]}';
          
          
     CompanyContacts= (CompanyContactsWrapper)JSON.deserialize(jsonInput,CompanyContactsWrapper.class);
         
     system.debug('==>'+CompanyContacts);
   
   }
}

In developer console I create an object and execute.
I get contact=null, postalcode=null & contactnumber=null.

pls tell where I have gone wrong?

thanks
divya manohar
I have below code so I run this ...
<aura:component implements="force:appHostable">
    <form>
    <fieldset>
    Enter three values:<br/>
    <ui:inputNumber aura:id="inputOne" label="Input One" /><br/>
    <ui:inputNumber aura:id="inputTwo" label="Input Two"/><br/>
    <ui:inputNumber aura:id="inputThree" label="Input Three"/><br/>
    <ui:button label="Calculate value" press="{!c.calculate}"/><br/>
        
    <ui:outputNumber aura:id="totalValue" value=""/>
   </fieldset>
</form>
</aura:component>

*Controller is *
({
    calculate : function(component, event, helper) {
        var input1=component.find("inputOne").get("v.value");
        var input2=component.find("inputTwo").get("v.value");
        var input3=component.find("inputThree").get("v.value");
        var totalval=parseInt(input1)+parseInt(input2)-parseInt(input3);
        var outputval = component.find("totalValue");
        outputval.set("v.value", totalval);
    }
})



 
Hello, 

I am a tinkerer at best, and am working on creating a PDF attachment to an email template... and I know almost nothing about CSS. 

I would like to be able to set a "Table-Fixed" attribute in CSS, but only apply the attribute to certain tables.  Is this possible? 

Also, my CSS is currently "in-line", and I would like to move it to a static resource, what is the proper syntax for adding the table attribut to what is currently there?  
 
<style>
@page{
size: A4 landscape;
}
</style>
Thank you so much in advance, I am so close to crossing this project off my list!
 
For example:
1. I'm using APIs of version 30.0, then which release notes is useful for me? Spring '14 or any other one?
2. I find that release Spring '15 has something necessary for me, then which API version should I use? 33.0 or any other one?

Thanks
  • October 28, 2015
  • Like
  • 0
 i am trying to write a test class on a simple trigger below but getting error
 
1. trigger accountrevenue on Account (before insert) {
2. list<account> acc=trigger.new;
3. for(account accs:acc){
4. if(accs.industry=='Banking')
5. accs.annualRevenue=5000000;
6. }
7. }



======================================
 
1. @isTest public class AnnualTest {
2. @isTest
3. static void testme(){
4. Integer count=[select count() from Account];
5. Account a1=new Account(Name='aaa',Industry='Banking');
6. Account a2=new Account(name='bbb',Industry='Energy');
7. try{
8. insert a1;
9. insert a2;
10. } catch(Exception e) {
11. System.debug(e);
12. }
13. Integer size=[select count() from Account];
14. System.assertEquals(size,count+2);
15. Account acc=[select annualrevenue from Account where id=:a1.id];
16. System.assertEquals(acc.annualRevenue,5000000);
17. Account acc1=[select annualrevenue from Account where id=:a2.id];
18. System.assertNotEquals(acc1.annualRevenue,a1.AnnualRevenue);
19. }
20. }



============================================
TestRun result = Fail
TestRun Error = System.AssertException: Assertion Failed: Expected: 0, Actual: 2
TestRun Stack trace = Class.AnnualTest.testme: line 14, column 1
String objType=’Account’;
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(objType);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();


 
Hi all,

I made some changes to Apex class code and all tests come back without a failure. However, when I try to deploy and run the validation, I still get below 75% coverege but there is no explanation. Does anyone know how to resolve this?

Deployment Validation Error

Thanks
Nitzan
Hello,

How to find a label in Salesforce

What i know ?
- Use eclipse to find in trigger, apex classes and VF pages

What I dont know
- If the label is used for Custom labels or record types label

I want to find all the labels used everywhere, like workflow rule names, approval names, custom labels, etc

Thank you !
  • September 30, 2015
  • Like
  • 0
I need a table with all the custom fields in case standard object.
This code does not actuall create a table. what am I missing?

<apex:page standardController="case" recordsetVar="coil">
    <apex:pageBlock Title="Coil Information">
         <apex:pageBlockTable value="{!coil}" var="a">
            <apex:column value="{!a.Claim_Case_Number__c}"/>
            <apex:column value="{!a.Coil_Cost__c}"/>
            <apex:column value="{!a.Coil_ID__c}"/>
            <apex:column value="{!a.CSV__c}"/>
            <apex:column value="{!a.ACC__c}"/>
                    
         </apex:pageBlockTable>
       
    </apex:pageBlock>
</apex:page>
  • September 10, 2015
  • Like
  • 0
Hi, 
I have created a batch apex job and want to send emails to all the team members when the job is completed. Right now, I am only able to send one email. I intend to send emails to all the team members.  Below is the  class that I have created. 
global class batchPPBInsert implements Database.Batchable<sObject>
{

    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        //Query Record
    }
   
    global void execute(Database.BatchableContext BC, List<Pelco_Price_Book_Stage__c> scope)
    {
        //execute db operation
    }   
    global void finish(Database.BatchableContext BC)
    {
        String email;
        email='gagnihot@gmail.com';
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
		mail.setToAddresses(new String[] {email});
		mail.setReplyTo('gagnihot@gmail.com');
		mail.setSenderDisplayName('Batch Processing');
		mail.setSubject('Batch Process Completed');
		mail.setPlainTextBody('Batch Process has completed');	
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

Thanks, 
Gaurav
The challenge begins:
 
"To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode)."

Here my problem: these fields do not exist within my developer edition. The only thing I have is MailingAddress, whereas this challenge asks for a postal code field. Other documentation (https://help.salesforce.com/HTViewHelpDoc?id=fields_useful_validation_formulas_contact.htm&language=en_US) refers to nonexistent fields like MailingStreet and MailingCountry. Or at least, they're nonexistent for me. Here's a screenshot:

User-added image

I can't create the missing fields myself, because then the API name would be "MailingPostalCode__c" etc. for custom fields, and that would be wrong.

Is my dev implementation flawed somehow? Any idea how I might fix that?
Can you please answer this 
What can user do with Mobile Lite?
Choose 2 answers
a. View Create Edit and Delete Accounts Contact and Opportunities
b. View Campaign and manage Campaign Member.
c. View Create Edit and Delete Custom Objects.
d. Search for record that was not previously downloaded to a mobile device.
  • August 25, 2015
  • Like
  • 0
Morning,

I am currently having an issue displaying data from newly added fields within my php page?

Here is an example.
http://cvm.org.uk/salesforce/sport-details?id=003D000001r6G3tIAE

Missing data is the in the image and where shown on webpage.

Any advice? :S 

Many thanks Kirsty

php page
Hi,

Iam trying to get populate field values into popup page while cliking on formula field on custom detail page.  

getting error: Id value is not valid for the Visitor__c standard controller

and also values not populating popup fields.

VF Page:

<apex:page standardController="Visitor__c" sidebar="false" extensions="CustomVisitorDetailExt" >
<script>
 var newWin=null;
 
 function openLookupPopup(mid)
 {
  var url="/apex/PopUpforVisitor?id=" +mid;
  <!--var url="/apex/PopUpforVisitor";-->
  newWin=window.open(url, 'Popup','height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
  if (window.focus) 
  {
   newWin.focus();
  }
    
     return false;
    }
       
 function closeLookupPopup()
 {
    if (null!=newWin)
    {
       newWin.close();
    }  
 }
</script>
<apex:form >
<apex:actionFunction name="VisitorAddress" action="{!VisitorAddress}" rerender="accinfo, msgs" >
<apex:param name="recordId" value="" assignTo="{!recordId}"/>
</apex:actionfunction>
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection Title="Visitor Details:" collapsible="false" id="accinfo">
<apex:outputField value="{!Visitor__c.name}"/>
<apex:outputField value="{!Visitor__c.Gender__c}"/>
<apex:outputField value="{!Visitor__c.Email__c}"/>
<apex:outputField value="{!Visitor__c.Phone__c}"/>
<apex:outputField value="{!Visitor__c.Patient__c}"/>
<apex:outputField value="{!Visitor__c.Relashionship__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection Title="Address Information:" collapsible="false">

<apex:inputField value="{!Visitor__c.Current_Address__c}" onclick="openLookupPopup('{!$Component.targetName}', '{!$Component.targetId}');"/>
<!--<apex:inputField value="{!Visitor__c.Current_Address__c}" onclick="openLookupPopup('{!myd}');return false;"/>-->
 
  <!--<apex:outputText value="{!Visitor__c.Current_Address__c}"  />
  <apex:outputlink onclick="window.showModalDialog('\apex\PopUpforVisitor')" target="_blank"  value="/{Visitor__c.id}" > {!Visitor__c.Current_Address__c}
   <apex:actionSupport event="onClick" action="{!VisitorAddress}" reRender="result,mypage" status="status"/>
  </apex:outputlink>-->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Popup VF Page:

<apex:page standardController="Visitor__c" sidebar="false" showHeader="false" extensions="CustomVisitorDetailExt">
<apex:form >
<apex:pageBlock >

<apex:pageBlockSection Title="Address Information:" collapsible="false" columns="1">
  <!--<apex:repeat value="{!$ObjectType.Visitor__c.fieldsets.Address}" var="fValue">
                 <apex:outputfield value="{!Visitor__c[fValue]}"/>
             </apex:repeat>-->
<apex:inputField value="{!Vist.Address_Line1__c}"/>  
<apex:inputField value="{!vist.Address_Line2__c}"/>  
<apex:inputField value="{!vist.City__c}"/>  
<apex:inputField value="{!vist.State__c}"/>  
<apex:outputField value="{!vist.PinCode__c}"/>  
<apex:inputField value="{!vist.Land_Mark__c }"/>  
 
          
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Class:

public with sharing class CustomVisitorDetailExt {
public visitor__c vist {get;set;}
public id recordId {get;set;}
public id myd {get;set;}

public ApexPages.StandardController standardCon;
    public CustomVisitorDetailExt(ApexPages.StandardController con) {
    standardCon=con;
    vist =new visitor__c();
  myd=apexpages.currentpage().getparameters().get('recordId');
System.debug('>>>>urlid' +myd);
    }
public PageReference VisitorAddress(){
PageReference page=new PageReference('/apex/PopUpforVisitor?id=' +myd);

 //visitor__c vis= (visitor__c) standardCon.getRecord();
    vist= [select Address_Line1__c,Address_Line2__c,City__c,PinCode__c,State__c,Land_Mark__c from visitor__c where id =: myd ];
    //vist.Address_Line1__c=vis.Address_Line1__c;
    //vist.Address_Line2__c=vis.Address_Line2__c;
    //vist.Address_Line1__c=apexpages.currentpage().getparameters().get('vis.Address_Line1__c');
    //vist.Address_Line2__c=apexpages.currentpage().getparameters().get('vis.Address_Line2__c');
return page;
}
}

Please help me to solve this issue.

Regards,
Sain
  • August 12, 2015
  • Like
  • 0
I have one lightning component which I have added in console
openPrimaryTab() method is no longer working in new lighting service console introduced in Spring '17. I have already added integration.js so sforce object is available in javascript

Sfdc.xdomain.Caller in integration.js (line 350) returns object while running in lightning console app it is null.

any idea?

Hi,

 

I want to show Salesforce related content in custom vf page of opportunity as related list. so I require relationship name for this object. when I see opportunity pagelayout this available as Related content.

 

Can anybody help.

 

Thanks,

Himanshu

How can we get OpportuintyLineItemSchedule sum per quater

what is queue alternative solution available in salesforce if i have Mater details relationship with and salesforce doesn't show my custom object in queue creation list.

On User Object there is Delegated Approver which has lookup(user,Group) 

 

what does Group signifies here because when i search for group it doesn't show me group in lookup window.

can anybody explain what is version in REST API resource
ie. /services/data/v36.0/sobjects/, what this version is? which version shall i use?
and if my customer upgrades it's instance to new version what required changes ill need to make
Hi,

I am using this ip 0.0.0.0,255.255.255.255 in my full copy of sandbox org to login at my Home.Is there any problem with this.
Hi Friends,

I have a requirement with 2 record types
when i choose X record type it should display opportunity standard page 
when i choose Y record type it should display VF Page with opportunity mandatory fields  

unable to do this , can any one help on this

Thanks
How to file an issue to Salesforce bugs?
Is there way directly contact with developers or some mailing lists?
Hi

open execute anonymous window is disabled in developer console. Due to this I'm unable to write and execute any apex code.
Please let me know how I can enable it.

Sarvesh
Hello Guy,

I am using trial version of SalerForce. I am trying to call the Force Rest API but I am getting response like this:

    "message": "The REST API is not enabled for this Organization.",
    "errorCode": "API_DISABLED_FOR_ORG"

I got few soultions. It was saying that I need to check API enable check box in "Manage User -> User -> System Administraiton -> Administrative Permission" .But  I found it is checked. . 

I am still gettting same error . 
Please help me.

Thanks and Regards,
Vishwas
 
Hi All,
I am the owner of a sandbox. I just wanted to know, will I get any kind of notification that the project has been donwloaded through eclipse?
  • February 27, 2016
  • Like
  • 0
Hello,

I've been tasked with creating an executive page layout where the basic information is displayed within a standard page layout and if they'd like to see more details they can click a link and see that. That translates into a Visualforce page.  I've gotten as far as creating the page, but where I'm stumped is displaying the multiple custom object related lists.  When I added them at first, I started to get the " '<object> is not a valid child relationship name for entity Account' " error.  After looking at this, I realised that several of the custom objects are related to the Account by way of other standard objects. An example of this is my Account Connections object. It has a Master-Detail relationship to the Contact object and can be viewed on the standard Account detail page.  How would I go about adding this custom object's related list into my VF code?  This is what I have thus far:
 
<apex:page standardController="account">
    <apex:sectionHeader title="Account" subtitle="{!account.FirstName}"/>
    <apex:pageBlock title="Account">

        <apex:pageBlockSection title="Account Information" columns="2">
            <apex:outputField title="Primary Relationship Manager" value="{!account.Primary_Relationship_Manager__c}"/>
            <apex:outputField title="Account Owner" value="{!account.OwnerId}"/>
            <apex:outputField title="Tax Exempt" value="{!account.Tax_Exempt__c}"/>
            <apex:outputField title="Account Record Type" value="{!account.RecordTypeId}"/>
            <apex:outputField title="EIN" value="{!account.EIN_Number__c}"/>
            <apex:outputField title="Account Name" value="{!account.Name}"/>
            <apex:outputField title="Type" value="{!account.Type}"/>
            <apex:outputField title="Parent Account" value="{!account.ParentId}"/>
            <apex:outputField title="Tocqueville City" value="{!account.Tocqueville_City__c}"/>
            <apex:outputField title="Preferred Name" value="{!account.Preferred_Name__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Description Information" columns="1">
            <apex:outputField title="Description" value="{!account.Description}"/>
            <apex:outputField title="Best Work Desc - 2014 CIPS" value="{!account.Best_Work_Desc_2014_CIPS__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Address & Contact Information" columns="2">
            <apex:outputField title="Phone" value="{!account.Phone}"/>
            <apex:outputField title="Secondary Phone" value="{!account.Secondary_Phone__c}"/>
            <apex:outputField title="Email" value="{!account.Email__c}"/>
            <apex:outputField title="Toll Free" value="{!account.TollFree__c}"/>
            <apex:outputField title="Secondary Email" value="{!account.Secondary_Email__c}"/>
            <apex:outputField title="Fax" value="{!account.Fax}"/>
            <apex:outputField title="Email Recipient" value="{!account.Email_Recipient__c}"/>
            <apex:outputField title="Call Before Fax" value="{!account.Call_Before_Fax__c}"/>
            <apex:outputField title="Website" value="{!account.Website}"/>
            <apex:outputField title="Pledge URL" value="{!account.Pledge_URL__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Additional Address Information" columns="2">
            <apex:outputField title="Other Street" value="{!account.Other_Street__c}"/>
            <apex:outputField title="Other City" value="{!account.Other_City__c}"/>
            <apex:outputField title="Other State/Province" value="{!account.Other_State_Province__c}"/>
            <apex:outputField title="Other Zip/Postal Code" value="{!account.Other_Zip_Postal_Code__c}"/>
            <apex:outputField title="Other Country" value="{!account.Other_Country__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Membership Information" columns="2">
            <apex:outputField title="Membership Status" value="{!account.UWA_Membership_Status__c}"/>
            <apex:outputField title="Segment" value="{!account.Segment__c}"/>
            <apex:outputField title="UW Org Number" value="{!account.UWOrgNumber__c}"/>
            <apex:outputField title="UW Metro Size" value="{!account.UW_Metro_Size__c}"/>
            <apex:outputField title="UW Org Number (old)" value="{!account.UW_Org_Number_old__c}"/>
            <apex:outputField title="UW Metro Alpha Code" value="{!account.Metro_Alpha_Code__c}"/>
            <apex:outputField title="Opportunity 150" value="{!account.Critical_150__c}"/>
            <apex:outputField title="Relationship Management Tier" value="{!account.Top_Strategic_Field_Relations__c}"/>
            <apex:outputField title="Major Market" value="{!account.Major_Market__c}"/>
            <apex:outputField title="RD Top Market" value="{!account.RD_Top_Market__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Social Media" columns="2">
            <apex:outputField title="YouTube URL" value="{!account.YouTube_URL__c}"/>
            <apex:outputField title="Twitter" value="{!account.Twitter__c}"/>
            <apex:outputField title="Vimeo URL" value="{!account.Vimeo_URL__c}"/>
            <apex:outputField title="Facebook Page" value="{!account.Facebook_Page__c}"/>
            <apex:outputField title="Vine URL" value="{!account.Vine_URL__c}"/>
            <apex:outputField title="Facebook Page Name" value="{!account.Facebook_Page_Name__c}"/>
            <apex:outputField title="Other Video Sharing URL" value="{!account.Other_Video_Sharing_URL__c}"/>
            <apex:outputField title="Tumblr URL" value="{!account.Tumblr_URL__c}"/>
            <apex:outputField title="Flickr URL" value="{!account.Flickr_URL__c}"/>
            <apex:outputField title="Pinterest URL" value="{!account.Pinterest_URL__c}"/>
            <apex:outputField title="Picasa Albums URL" value="{!account.Picasa_Albums_URL__c}"/>
            <apex:outputField title="LinkedIn URL" value="{!account.LinkedIn_URL__c}"/>
            <apex:outputField title="Instagram URL" value="{!account.Instagram_URL__c}"/>
            <apex:outputField title="Google+ URL" value="{!account.Google_URL__c}"/>
            <apex:outputField title="Other Photo Sharing URL" value="{!account.Other_Photo_Sharing_URL__c}"/>
            <apex:outputField title="Blog URL" value="{!account.Blog_URL__c}"/>
            <apex:outputField title="Social Media Council (SMC)" value="{!account.Social_Media_Council__c}"/>
            <apex:outputField title="SMC Start Date" value="{!account.SMC_Start_Date__c}"/>
            <apex:outputField title="SMC End Date" value="{!account.SMC_End_Date__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Campaign for the Common Good" columns="1">
            <apex:outputField title="CCG Participant" value="{!account.CCG_Participant__c}"/>
            <apex:outputField title="One Million Online Engagement Agreement" value="{!account.CCG_Terms_Conditions_Agreement__c}"/>
            <apex:outputField title="Company Affinity Groups" value="{!account.program_involvement__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Volunteerism" columns="1">
            <apex:outputField title="Volunteer Management Platform" value="{!account.Volunteer_Matching_Application__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Education Involvement" columns="2">
            <apex:outputField title="Education Focus Areas" value="{!account.Education_Focus_Areas__c}"/>
            <apex:outputField title="Other Education Focus Areas" value="{!account.Other_Education_Focus_Areas__c}"/>
            <apex:outputField title="Mobilization Dimensions" value="{!account.Mobilization_Dimensions__c}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection title="System Information" columns="2">
            <apex:outputField title="Account Division" value="{!account.Division}"/>
            <apex:outputField title="name ID" value="{!account.IMIS_name_ID__c}"/>
            <apex:outputField title="SalesforceId" value="{!account.SalesforceId__c}"/>
            <apex:outputField title="UWO Id" value="{!account.uwoId__c}"/>
        </apex:pageBlockSection>

            <apex:relatedList list="Contacts"/>
            <apex:relatedList list="Account Connection"/>
            <apex:relatedList list="OpenActivities"/>
            <apex:relatedList list="ActivityHistories"/>
            <apex:relatedList list="Cases"/>
            <apex:relatedList list="CombinedAttachments"/>

    </apex:pageBlock>
</apex:page>

I'm somewhat under a time crunch, so any help you the community can provide me is greatly appreciated!  Thank you so much.

Diavonna 
I am trying to populate a field in a Visualforce page for custom object using a controller extension. I would like to populate the field with one value if the User Role of the person creating the record is Sales and another value if they are Account Management. I'm not quite sure of the syntax I need to use to accomplish this in my controller. Can anyone assist?
 
public class VF_CampaignCaseCreateController{
public List<Campaign_Create_Request__c> CCR {get; set;}

    private final Opportunity opp;
    public VF_CampaignCaseCreateController(ApexPages.StandardController myController){
        CCR = new List<Campaign_Create_Request__c>();
            if (!Test.isRunningTest())
            {
            myController.addFields(new List<String>{'Id', 'OwnerId'});
            }
        opp=(Opportunity)myController.getrecord();
    }

    public Campaign_Create_Request__c CCR2 = new Campaign_Create_Request__c();
        public void CampaignCaseCreate(){

            CCR2.Opportunity__c = opp.Id;

            IF($UserRole.Name StartsWith('Sales')){
                CCR2.Sales_Rep__c = $UserRole.Id;
            }
            ELSE{
                CCR2.Sales_Rep__c = null;
            }   

            Opportunity o = [SELECT (SELECT Id, contactId
                                       FROM OpportunityContactRoles
                                       WHERE role = 'Signatory')
                            FROM Opportunity
                            WHERE id = :opp.id];
            CCR2.Primary_User__c = o.opportunityContactRoles.size() != 0 
                                    ? o.opportunityContactRoles[0].contactId  
                                    : null;

            CCR.add(CCR2);
        }
}

 
Hello, I have written a trigger that autmatically creates a Task record when a custom object record is created. The Owner of the Task is located through a string of related lookups. Currently, the trigger works, but it is not bulkified. I have attempted to bulkify the trigger, but I got lost is the logic and I could not find a similar piece of sample code to reference. Can someone point me in the right direction or give me some guidance.
 
trigger AutoCreateTask on Investigation__c (after insert) {

  List<Task> tasks = new List<Task>();

    for (Investigation__c newInv: Trigger.New) {

      Investigation__c investigation = [Select Id, RecordType.Name, Driver__c, Employee__c from Investigation__c where Id =: newInv.Id];


                
        if (investigation.RecordType.Name == 'Auto Investigation') {   
          Contact driver = [select Supervisor__c FROM Contact where Id =: investigation.Driver__c];
          Tasks.add(new Task( OwnerId = driver.Supervisor__c,
                              WhatId  = newInv.Id,
                              Subject = 'Please complete driver investigaiton',
                              ActivityDate = System.today().addDays(14),
                              Type = 'Investigation'
                              ));
        }

        if (investigation.RecordType.Name == 'Injury Investigations') {   
          Contact employee = [select Supervisor__c FROM Contact where Id =: investigation.Employee__c];
          Tasks.add(new Task( OwnerId = employee.Supervisor__c,
                              WhatId  = newInv.Id,
                              Subject = 'Please complete injury investigaiton',
                              ActivityDate = System.today().addDays(2),
                              Type = 'Investigation'
                              ));
        }    
    }    
  insert tasks;      
}

 
Hi Techies,

Hope evry one doing good. I am new to Salesforce Integraiton. Can some body help me/guide me how to start with. 
What are the best practises to learn salesforce integration. Requesting you all to give me your valuable suggestions to learn salesforce integration easily, also share your examples on salesforce integration.

Thanks in advance fellows.

Great day ahead.
Regards
Prad
Hi,

I want to create a tab in salesforce, if i click on that tab it has to call the lightning component which i created that component(along with component app) in developer console.


Thanks in advance.