• kaustav goswami
  • SMARTIE
  • 1614 Points
  • Member since 2014
  • Lead Developer

  • Chatter
    Feed
  • 51
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 235
    Replies
Hello - I am attempting to create a formula that will allow us to build metrics on case turn around time.  The formula will output a number based off of the "status" picklist selection.
There are two picklist options that can trigger the formula and I am having trouble figuring out how to have one formula that references a picklist field be able to take action on more than one picklist option.  
Below is what I have;

IF(TEXT(ThinkLP__Status__c) = "Verified True Variance", NOW() - CreatedDate, NULL)
OR(
IF(TEXT(ThinkLP__Status__c) = "Verified False Variance", NOW() - CreatedDate, NULL)

I have tried a number of different variations to the formual to no avail...any help is appreciated.

Thank You,
Christopher
I wanted to spruce up the text on a commandButton by applying more than one CSS font class on the button label, but I get errors when I use tags inside the value parameter

Page Code:
<apex:commandButton styleClass="btnOrange" action="{!postTourQuizLink}"
value="What did you <font class='Papyrus'>Learn</font> about <font class='Papyrus'>Wildcats</font>? <font class='Afrika'>\</font>"
title="Take the post-Tour Quiz" immediate="false" />

I've also tried removing the value param and putting the label text between tags: <apex:commandButton>Label</apex.commandButton>

I tried creating a variable quizButtonTxt inside the postTourQuizLink function (on the extension ctrl) and then putting value="{!quizButtonTxt}", also not helpful. 

I'm a SF Admin/code hacker-modifier, and so I don't know enough to come up with a workaround- any suggestions? Special character references?

 
Is there a way to embed a Visualforce page into a list view? Let me explain what I have done so far:

I have created a custom object within Salesforce called "Service Requests". Within the "Service Requests" object I have created a custom field called "Store Number". "Store Number" is a lookup relationship field that is related to another custom object called "Stores". When a service request is made we always include the store number so that we can tell which store needs service done. For instance, Service Request 0006 is for store number 2368. Now, if we use our mouse to hover over the store number, 2368, then we will see a hover detail window telling us that the store is located in East Stroudsburg, PA. But my client doesn't want to have to hover over the store number every time to see the location of the store. So, I have created a Visualforce page which references the store's location. Here is my code:


<apex:page standardController="Service_Request__c"> {!Service_Request__c.Store_Number__r.City__c}, {!Service_Request__c.Store_Number__r.State__c}</apex:page>

Using this code I am able to auto populate the store's location by referencing the custom fields, "City" and "State", which are found in the custom object "Stores". However, my client wants to be able to go into the "Service Requests" tab and, under the list views, he wants to see not only the "Request Number" (0006) and "Store Number" (2368) but also the "City" and "State" of the store (which would be related to the Store Number). But when I go to edit the list views I don't see the VF page in "Available Fields", so I can't move it over into "Selected Fields". 

Now, I've tried this code that someone else gave me:
<apex:pagestandardController="Service_Request__c" recordSetVar="s">
<apex:repeat value="{!s}" var="c">
<apex:outputText value="{!Service_Request__c.Store_Number__r.City__c}"/>
<apex:outputText value={!Service_Request__c.Store_Number__r.State__c}"/>
 <apex:outPutText value={!serviceRequest}/>
 <!--Add the fields which you want to show in thw list-->
  </apex:repeat>
</apex:page>

But every time I try to run it I keep getting a syntax error that says:

"Error: Unknown property 'Service_Request__cStandardController.serviceRequest'"

What do I do about this? Do I need to create a custom controller in the Developer Console? And if so, how do I begin to do that?? Any help would be greatly appreciated! Thank you very much!

Matt
I am still a very basic level when it comes to visualforce. I created a page that links to an external website (code below). I was wondering if there was a way to add in the print link that is found on Salesforce object pages. I know how to suppress the sidebar, but wasn't sure how to add "print" back in. 

<apex:page sidebar="false"> <script type="text/javascript" src="https://www.google.com/jsapi"></ script><script type="text/javascript">google.load("maps", "3", {other_params:"sensor=false"});</script><script language="javascript" src="//code.metalocator.com/index.php? option=com_locator&view=directory&layout=_javascript&framed=1&format=r aw&tmpl=component&no_html=1&Itemid=3627"></script> </apex:page>
 
I have a custom object which has lookup relationship with Account and Contact. On the account and contact page I have related list to that object. I have created 2 VF pages to display fields related to this custom object in the format I want. One of the VF page is for users who click on edit/new/view in the related list of the custom object on Account page and other is if the user comes from Contact page.
I'm trying to figure out how to redirect user to a particuar VF page depending on whether they click view/edit/new in the related list on Account or Contact page. 

Thanks for help.
  • June 04, 2015
  • Like
  • 0
Each custom field below is a numeric value.  I need a formula that adds these in the following pairs as shown below.  How to only add "Tier__c +  Scope__c", if the other pair is null?  And vice versa?

Health__c +  Priorty__c

Tier__c +  Scope__c 
I'm new to developing. I'm creating a public visualforce web-to-lead site. I want to pass values to Company, Lead Source, and probably a few others. I tried following a few examples (the /script portions of my VF page is where I tried to pass a value but it's a complete failure). My guess is that I need to establish components and then assign them somehow to the Lead fields.

Any info on how I can prepopulate those values would be great.

My Extension
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
}

My VF page 
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Contact Us" showHeader="false"
           standardStylesheets="true">
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form >
   <apex:inputtext id="mpCompany"/>
        <script>
            var mpCompany = "{!$Component.mpCompany}";
        </script>
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Save"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact Us"
                               collapsible="false"
                               columns="1">
         <apex:inputField value="{!Lead.Salutation}"/>
         <apex:inputField value="{!Lead.FirstName}"/>
         <apex:inputField value="{!Lead.LastName}"/>
         <apex:inputField value="{!Lead.Email}"/>
         <apex:inputField value="{!Lead.Phone}"/>
         <apex:inputField value="{!Lead.Street}"/>
         <apex:inputField value="{!Lead.City}"/>
         <apex:inputField value="{!Lead.State}"/>
         <apex:inputField value="{!Lead.PostalCode}"/>
         <apex:inputField value="{!Lead.Country}"/>
         <apex:inputField value="{!Lead.Company}"/>
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
   <script>
        window.onload=function()
        {

         document.getElementById(mpCompany).self = "{!$CurrentPage.parameters.Company}";
        };
    </script>
  </apex:define> 
 </apex:composition>
</apex:page>

 
Hello Helper


I  have to  consume a Webservice written in Biztalk  from an apex batch class

I  have the WSDL
I  created the stub  classes
I was able to  build my bussiness logic


I am looking  for some articles or  guidabce how  to setup  Salesforce  to  be able  to call the webservice method

Do I need a Remote Access app?

How  I  manage the login?

Other things  to consider?

Thanks in advance
csbaa

 
  • April 17, 2015
  • Like
  • 0
Hello Helper

I  have a question  about the design ans usage  of Apex Webservice  

I  have to write a  webservice in apex  which  will  be called  from a Biztalk application

I know how  to create  the Webervice.

What  is  do not  know  is  who  should  care about  Login to Salesforce org?

The Web service class  has  to contain a method  for Login  ?
OR
the caller  of the Web Service  has to take  care of  logging first to the Salesfoce org then call  my Webservice ?

what  is  the best practice here?

I preffer to  let this task  at  user side  but I am not  sure this  is a reasonable  approach

Thanks  in advance
Csbaa
  
  • April 05, 2015
  • Like
  • 1
Can someone please provide a formula?

I have a single grand total amout field. I have various percentage fields that should equal a compoent of the grand total amount (but the various percentage fields must not cap more than 100% combined).

For example;

Grand Total Amount =  $200,000

Product 1 - 70%
Prouct 2 - 20%
Product 3 - 10%

If a percentage is attempted in product 4 or 5 based on the previous percentage amounts; a validation rule wll require a change. For example;

Product 4 - (must be reestricted unless a percentage in Product 1, 2, or 3 is lowered. Cannot be more than 100% of grand total).
Product 5 - (must be reestricted unless a percentage in Product 1, 2, or 3 is lowered. Cannot be more than 100% of grand total).
 
Hello All!
I am hoping you can assist me with an error I am receiving:
"Save error: Method does not exist or incorrect signature: vcport2(List<RPSWS.WebSearch_element>)    RPSWS2.cls"

//---------- BEGIN RPSWS2.cls
public class RPSWS2 {
     public static Boolean AsyncWebSearchFlag = false;
    
    @Future(callout=true) 
    public static void RPSWS(Set<ID> ids) {
        try {
            // Build list of addresses to validate
            Map<ID, Supplier__c> mapCands = findCandidates(ids);
            List<RPSWS.WebSearch_element> vclistAddress = new List<RPSWS.WebSearch_element>();

            for (Supplier__c scand : mapCands.values()) {
                RPSWS.WebSearch_element address = new RPSWS.WebSearch_element();
                
                address.sSecno = 'XYZ';
                address.sPassword = '123Pass';
                address.sOptionalID = scand.ID;
                address.sName = scand.Legal_Name__c;
                address.sAddress = '$' + scand.Legal_City__c + '$' + '{'+ scand.Legal_State__c + '}';
                address.sCountry = 'USA';
                vclistAddress.add(address);
            }
                        
            // Make callout
            RPSWS.RPSServiceSoap vcport2 = new RPSWS.RPSServiceSoap();
            List<RPSWS.WebSearchResponse_element> vclistResult = vcport2.WebSearch_element(vclistAddress); //THIS IS WHERE THE ERROR IS


            // Verify results
            for (RPSWS.WebSearchResponse_element vcresult : vclistResult) {
                Supplier__c scand = mapCands.get(vcresult.WebSearchResult);
                if (vcresult.WebSearchResult.contains('GREEN FLAG')) {
                    scand.Visual_Compliance_Approval__c = true;
                    scand.Visual_Compliance_Reason_Code__c = 'AUTO: ' + datetime.now();
                } else {
                    scand.Visual_Compliance_Approval__c = false;
                    scand.Visual_Compliance_Reason_Code__c = 'Invalid Address';                 
                }
            }
            
            // Update Candidate
            AsyncWebSearchFlag = true;
            update mapCands.values();
        } catch (Exception ex) {
            // Handle Exception
            System.debug('ERROR: '+ ex);
            Error_Log__c log = new Error_Log__c();
            log.trace__c = ex.getCause() + '\n' + ex.getMessage();
            insert log;        
        }
    }

    private static Map<ID, Supplier__c> findCandidates(Set<ID> ids) {
        Map<ID, Supplier__c> output;
        output = new Map<ID, Supplier__c>([SELECT ID, Legal_Name__c, Legal_City__c,
                                                Legal_State__c, Legal_Postal_Code__c
                                            FROM Supplier__c
                                            WHERE ID in :ids]);
        return output;
    }                   
}

//---------- BEGIN RPSWS.cls
public class RPSWS {
    public class WebSearchResponse_element {
        public String WebSearchResult;
        private String[] WebSearchResult_type_info = new String[]{'WebSearchResult','http://tempuri.org/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'WebSearchResult'};
    }
    public class WebSearch_element {
        public String sSecno;
        public String sPassword;
        public String sOptionalID;
        public String sName;
        public String sCompany;
        public String sAddress;
        public String sCountry;
        public String sModes;
        public String sRPSGroupBypass;
        private String[] sSecno_type_info = new String[]{'sSecno','http://tempuri.org/',null,'0','1','false'};
        private String[] sPassword_type_info = new String[]{'sPassword','http://tempuri.org/',null,'0','1','false'};
        private String[] sOptionalID_type_info = new String[]{'sOptionalID','http://tempuri.org/',null,'0','1','false'};
        private String[] sName_type_info = new String[]{'sName','http://tempuri.org/',null,'0','1','false'};
        private String[] sCompany_type_info = new String[]{'sCompany','http://tempuri.org/',null,'0','1','false'};
        private String[] sAddress_type_info = new String[]{'sAddress','http://tempuri.org/',null,'0','1','false'};
        private String[] sCountry_type_info = new String[]{'sCountry','http://tempuri.org/',null,'0','1','false'};
        private String[] sModes_type_info = new String[]{'sModes','http://tempuri.org/',null,'0','1','false'};
        private String[] sRPSGroupBypass_type_info = new String[]{'sRPSGroupBypass','http://tempuri.org/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'sSecno','sPassword','sOptionalID','sName','sCompany','sAddress','sCountry','sModes','sRPSGroupBypass'};
    }
    public class RPSServiceSoap {
        public String endpoint_x = 'vendor webservice here';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://tempuri.org/', 'RPSWS'};
        public String WebSearch(String sSecno,String sPassword,String sOptionalID,String sName,String sCompany,String sAddress,String sCountry,String sModes,String sRPSGroupBypass) {
            RPSWS.WebSearch_element request_x = new RPSWS.WebSearch_element();
            request_x.sSecno = sSecno;
            request_x.sPassword = sPassword;
            request_x.sOptionalID = sOptionalID;
            request_x.sName = sName;
            request_x.sCompany = sCompany;
            request_x.sAddress = sAddress;
            request_x.sCountry = sCountry;
            request_x.sModes = sModes;
            request_x.sRPSGroupBypass = sRPSGroupBypass;
            RPSWS.WebSearchResponse_element response_x;
            Map<String, RPSWS.WebSearchResponse_element> response_map_x = new Map<String, RPSWS.WebSearchResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/WebSearch',
              'http://tempuri.org/',
              'WebSearch',
              'http://tempuri.org/',
              'WebSearchResponse',
              'RPSWS.WebSearchResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.WebSearchResult;
        }
    }
}
Ihave this JSON :  

public  class Exinteg {
public string result{get;set;}
public Exinteg()
{
    
    JSONGenerator jg = JSON.CreateGenerator(true);
    jg.writestartObject();
    jg.writestringfield('Name','Sathish');
    jg.writeNumberField('age',30);
    jg.writeFieldName('Account');
    list<account> acc= [select name,industry from account limit 2];  
    jg.writeObject(acc);
  // What processing internally at this line 
    jg.writeFieldName('myarray');
    jg.writestartArray();
    jg.writenumber(10);
    jg.writenumber(20);
    jg.writeEndArray();
    jg.writeEndObject();
    result=jg.getAsString();
    
}
}



{ "Name" : "Sathish", "age" : 30, "Account" : [ { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6BAAR" }, "Name" : "Sunkeert", "Id" : "0019000001Epo6BAAR", "Industry" : "Chemical" }, { "attributes" : { "type" : "Account", "url" : "/services/data/v33.0/sobjects/Account/0019000001Epo6CAAR" }, "Name" : "Samba", "Id" : "0019000001Epo6CAAR", "Industry" : "Chemical" } ], "myarray" : [ 10, 20 ] }



i was fetching only name and industry fields from account but why the other coming to JSON? which i didn't use in SOQL Query (in bold above).
Hello,

I have an image formula field on Case which is showing one of the standard Salesforce flags (grren, yellow, or red) based on the time remaining on when the case should be resolved The formula for this field is below:

IMAGE(
IF((Minutes_to_Deadline__c > (SLA_Minutes_2__c * 0.25)),"/img/samples/flag_green.gif",
IF(Minutes_to_Deadline__c < 0, "/img/samples/flag_red.gif",

IF((Minutes_to_Deadline__c > 0 && Minutes_to_Deadline__c <=(SLA_Minutes_2__c * 0.25)) , "/img/samples/flag_yellow.gif",""

))),"None")


I am now trying to reference this field in a Visualforce page in the case console. I am able to save the page with this field in the code, but when I open the console and look at the component which is built from the visualforce page, it outputs the url of image (e.g. "/img/samples/flag_red.gif") instead of the image. I believe this was because I had "apex:outputText" in the code:

<apex:outputText value="{!con1.Case_SLA__c}"/>

I then changed this to be (although i know I'm missing something):

<apex:image id="flag" value="{!con1.Case_SLA__c}"/>

It now only shows a broken image.
User-added image
Does anyone know how I can get this to show the flag that is in the formula field? Or do I have to put logic in either the Visualforce page or Controller to show what I want it to show?

Thanks,
Adam
 
Hi,

I have a question. I can see this code is working fine in my org 
<apex:page standardController="Opportunity">
    <apex:outputLabel>{!Opportunity.Name}</apex:outputLabel>
    <apex:outputLabel>{!Opportunity.StageName}</apex:outputLabel>
    <apex:outputText value="{!IF(Opportunity.StageName=="Prospecting", 'Test 1', IF(Opportunity.StageName=="Proposal/Price Quote", 'Test 2', IF(Opportunity.StageName=="Needs Analysis", 'Test 3', IF(Opportunity.StageName=="Negotiation/Review", 'Test 4','Test 5'))))}"/>
</apex:page>


But the challange keeps saying:

Challenge not yet complete... here's what's wrong: 
The page isn't evaluating the 'Negotiation Review' stage.


Very frustrating. Anyone an idea?
Much appreciated in advance.


 
Hey there,

I have created a class using help from this thread: http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html .

I have successfully created a button on my Account visualforce page which allows me to upload a csv, which inserts a fact finder record. This csv also has fields for two contact records. I have attempted to insert these records as well, however the class failed when i tried to insert them as a list.

My questions are:

1.Could someone help me to change my code that it accepts the contact list for upload. Currently when i test it, the code fails at line 55....which is - Constoupload.add(con1);
2.I was hoping to get someone help on some logic. The goal is to make it so that upon upload, the class will check any contacts associated with the account. If they exist then I would want them to be updated with the new information and if they dont then the csv data is inserted. 

Please help and thank you in advance for your help. My class is below.
 
public class FileUploader2 
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    public Account Acc{get;set;}
    List<Discovery_Fact_Finder__c> FFtoupload;
    List<Contact> Constoupload;
    public FileUploader2 (ApexPages.StandardController stdController){
    this.Acc = (Account)stdController.getRecord();
    }
    
    public Pagereference ReadFile()
    {
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        FFtoupload = new List<Discovery_Fact_Finder__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            Contact Con1 = new contact();
            Con1.AccountId = acc.id;
            Con1.Title = inputvalues[1];
            Con1.Firstname = inputvalues[2];
            Con1.Middle_Name__c = inputvalues[3];
            Con1.LastName = inputvalues[4];
          //Con1.Birthdate = inputvalues[5];
            Con1.marital_Status__c = inputvalues[6];
            Con1.HomePhone  = inputvalues[7];
            Con1.OtherPhone = inputvalues[8];
            Con1.MobilePhone = inputvalues[9];
            Con1.Fax = inputvalues[10];
            Con1.Email = inputvalues[11];
           //Con1.OtherUnitNo = inputvalues[12];
          //Con1.OtherStreetNo = inputvalues[13];
            Con1.OtherStreet = inputvalues[14];
            Con1.OtherCity = inputvalues[15];
            Con1.OtherState = inputvalues[16];
            Con1.OtherPostalCode = inputvalues[17];
            Con1.OtherCountry = inputvalues[18];
          //Con1.ResidentialDateMovedin = inputvalues[19];
            Con1.Postal_Address_Residential_Address__c = Boolean.valueOf(inputvalues[20]);
          //Con1.MailingUnitNo = inputvalues[21];
          //Con1.MailingStreetNo = inputvalues[22];  
            Con1.MailingStreet = inputvalues[23];
            Con1.MailingCity = inputvalues[24];
            Con1.MailingState = inputvalues[25];
            Con1.MailingPostalcode = inputvalues[26];
            Con1.MailingCountry = inputvalues[27];
          //Con1.Australian_Resident = inputvalues[28];
            Con1.Destiny_VIP__c = Boolean.valueOf(inputvalues[29]);
            
            Constoupload.add(con1);

            
            If(Decimal.valueOf(inputvalues[81]) > 1 ){
            
            Contact Con2 = new contact();
            Con2.AccountId = acc.id;
            Con2.Title = inputvalues[30];
            Con2.Firstname = inputvalues[31];
            Con2.Middle_Name__c = inputvalues[32];
            Con2.LastName = inputvalues[33];
          //Con2.Birthdate = inputvalues[34];
            Con2.marital_Status__c = inputvalues[35];
            Con2.HomePhone  = inputvalues[36];
            Con2.OtherPhone = inputvalues[37];
            Con2.MobilePhone = inputvalues[38];
            Con2.Fax = inputvalues[39];
            Con2.Email = inputvalues[40];
           //Con2.OtherUnitNo = inputvalues[42];
          //Con2.OtherStreetNo = inputvalues[43];
            Con2.OtherStreet = inputvalues[44];
            Con2.OtherCity = inputvalues[45];
            Con2.OtherState = inputvalues[46];
            Con2.OtherPostalCode = inputvalues[47];
            Con2.OtherCountry = inputvalues[48];
          //Con2.ResidentialDateMovedin = inputvalues[49];
            Con2.Postal_Address_Residential_Address__c = Boolean.valueOf(inputvalues[50]);
          //Con2.MailingUnitNo = inputvalues[51];
          //Con2.MailingStreetNo = inputvalues[52];  
            Con2.MailingStreet = inputvalues[53];
            Con2.MailingCity = inputvalues[54];
            Con2.MailingState = inputvalues[55];
            Con2.MailingPostalcode = inputvalues[56];
            Con2.MailingCountry = inputvalues[57];
          //Con2.Australian_Resident = inputvalues[58];
            Con2.Destiny_VIP__c = Boolean.valueOf(inputvalues[59]);
            
            //Constoupload.add(con2);
                                                }
            
            Discovery_Fact_Finder__c FF = new Discovery_Fact_Finder__c();
            FF.Name = inputvalues[0];
            FF.No_Adults_with_Combined_Financials__c = Decimal.valueOf(inputvalues[81]);       
            FF.No_Dependant_Children__c = Decimal.valueOf(inputvalues[82]);
            FF.No_Properties__c = Decimal.valueOf(inputvalues[83]);
            FF.No_Loan_Accounts__c = Decimal.valueOf(inputvalues[84]);
            FF.No_Savings_Accounts__c = Decimal.valueOf(inputvalues[85]);
            FF.Contact_One_Personal_Gross_Taxable__c  = Decimal.valueOf(inputvalues[90]);
            FF.Contact_One_Investment_Property__c   = Decimal.valueOf(inputvalues[91]);
            FF.Contact_One_Non_Property_Asset__c    = Decimal.valueOf(inputvalues[92]);
            FF.Contact_One_Tax_Medicare__c    = Decimal.valueOf(inputvalues[93]);
            FF.Contact_One_Salary_Sacrifice__c    = Decimal.valueOf(inputvalues[94]);
            FF.Contact_One_Family_Benefits__c     = Decimal.valueOf(inputvalues[95]);
            FF.Contact_One_Non_Taxable__c     = Decimal.valueOf(inputvalues[96]);
            FF.Contact_One_Net_Yearly_Income__c     = Decimal.valueOf(inputvalues[97]);
            FF.Contact_One_Company_Car__c     = Boolean.valueOf(inputvalues[98]);
            FF.Contact_two_Personal_Gross_Taxable__c  = Decimal.valueOf(inputvalues[99]);
            FF.Contact_two_Investment_Property__c   = Decimal.valueOf(inputvalues[100]);
            FF.Contact_two_Non_Property_Asset__c    = Decimal.valueOf(inputvalues[101]);
            FF.Contact_two_Tax_Medicare__c    = Decimal.valueOf(inputvalues[102]);
            FF.Contact_two_Salary_Sacrifice__c = Decimal.valueOf(inputvalues[103]);
            FF.Contact_Two_Family_Benefits__c = Decimal.valueOf(inputvalues[104]);
            FF.Contact_two_Non_Taxable__c     = Decimal.valueOf(inputvalues[105]);
            FF.Contact_two_Net_Yearly_Income__c     = Decimal.valueOf(inputvalues[106]);
            FF.Contact_two_Company_Car__c     = Boolean.valueOf(inputvalues[107]);
            FF.Total_Net_Income__c      = Decimal.valueOf(inputvalues[108]);
            FF.Loan_Payments__c     = Decimal.valueOf(inputvalues[109]);
            FF.Household_Expenses__c   = Decimal.valueOf(inputvalues[110]);
            FF.Medical_Expenses__c  = Decimal.valueOf(inputvalues[111]);
            FF.Motor_Vehicle_Expenses__c = Decimal.valueOf(inputvalues[112]);
            FF.Personal_Expenses__c = Decimal.valueOf(inputvalues[113]);
            FF.Insurance_Expenses__c = Decimal.valueOf(inputvalues[114]);
            FF.Education_Expenses__c = Decimal.valueOf(inputvalues[115]);
            FF.Other_Expenses__c = Decimal.valueOf(inputvalues[116]);
            FF.Investment_Property_Assets_Expenses__c = Decimal.valueOf(inputvalues[117]);
            FF.Investment_Non_Property_Assets_Expenses__c = Decimal.valueOf(inputvalues[118]);
            FF.Total_Yearly_Expenses__c = Decimal.valueOf(inputvalues[119]);
            FF.Yearly_After_Tax_Personal_Cashflow__c = Decimal.valueOf(inputvalues[120]);
            FF.Personal_Property__c= Decimal.valueOf(inputvalues[121]);
            FF.Personal_Non_Property__c = Decimal.valueOf(inputvalues[122]);
            FF.Investment_Property__c = Decimal.valueOf(inputvalues[123]);
            FF.Investment_Non_Property__c = Decimal.valueOf(inputvalues[124]);
            FF.Savings__c  = Decimal.valueOf(inputvalues[125]);
            FF.Total_Asset_Value__c = Decimal.valueOf(inputvalues[126]);
            FF.Personal_Property_Assets__c = Decimal.valueOf(inputvalues[127]);
            FF.Personal_Non_Property_Assets__c = Decimal.valueOf(inputvalues[128]);
            FF.Investment_Property_Assets__c = Decimal.valueOf(inputvalues[129]);
            FF.Investment_Non_Property_Assets__c = Decimal.valueOf(inputvalues[130]);
            FF.Non_Asset_Linked__c = Decimal.valueOf(inputvalues[131]);
            FF.Total_of_Credit_Card_Limits__c = Decimal.valueOf(inputvalues[132]);
            FF.Total_Debt_Amount__c= Decimal.valueOf(inputvalues[133]);
            FF.Loan_Debt_Balanced__c = Boolean.valueOf(inputvalues[134]);
            FF.Total_Net_Worth_with_Savings__c = Decimal.valueOf(inputvalues[135]);
            FF.Total_Net_Worth_without_Savings__c = Decimal.valueOf(inputvalues[136]);
            FF.Total_Property_Net_Worth__c = Decimal.valueOf(inputvalues[137]);
            FF.Contact_One_Risk_Profile__c = inputvalues[138];
            FF.Contact_Two_Risk_Profile__c = inputvalues[139];
            FF.Account__c = Acc.id;

            FFtoupload.add(FF);
        }
        try{
        insert FFtoupload;
        insert Constoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
         PageReference p= new PageReference('/apex/DestinyAccount?id='+Acc.id+'&sfdc.override=1');
        p.setRedirect(true);
        p.getParameters().put('tab','Destiny Fact Finder');
        return p;
    }
    
    public List<Discovery_Fact_Finder__c> getuploadedFactFinder()
    {
        if (FFtoupload!= NULL)
            if (FFtoupload.size() > 0)
                return FFtoupload;
            else
                return null;                    
        else
            return null;
    }            
}

 
I am using an apex form to insert data into a custom object. My code is:
<apex:form>
<apex:pageBlock mode="edit">
      <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Submit" styleClass="btn blu btn-data"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection columns="1">
        <apex:inputField value="{!Comments__c.Name}"/>
        <apex:inputField value="{!Comments__c.Subject__c}"/>
        <apex:inputField value="{!Comments__c.Comments__c}"/>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
I know this is easily done with a standard controller, but I have a repeater in use already that uses a custom controller. How would I add this capability to my custom controller?

Custom Controller:
public with sharing class challengeDiscuss {
    public List<Challenge__c> getRecentChallenge1()
    {
        return [SELECT Id, Name, CreatedDate, Description__c FROM Challenge__c order by createdDate desc Limit 1];
    }
    public List<Challenge_Comment__c> getRecentComments10()
    {
        return [SELECT Id, Name, CreatedDate, Comment__c FROM Challenge_Comment__c order by createdDate desc, CreatedDate desc Limit 10];
    }
  
}
Thanks!!


I have a plain text VF email template that I'm working on.  It needs to be plain text so that the user can add some information before sending.

I'm attempting to show one address if the account is a person account and another if it's a standard account. 

With the code below I'm getting "syntax error", not very descriptive.  Any ideas?

<messaging:emailTemplate subject="RMA Request" recipientType="User" relatedToType="Case" >
<messaging:plainTextEmailBody >

Returning From:
 
Account Number - {!relatedto.Account.Customer_Number__c}
Name - {!relatedto.Contact.Name}
Address - {!IF(relatedTo.Account.IsPersonAccount, {!relatedto.Account.PersonShippingStreet}, {relatedto.Account.ShippingStreet})}



Phone - {!relatedto.Contact.Phone}
Email - {!relatedto.Contact.Email}


</messaging:plainTextEmailBody>
</messaging:emailTemplate>

  • October 14, 2014
  • Like
  • 0
Hi - 
I'm creating a VisualForce email template to be sent out via a workflow.

The users would like certain words "Bolded", and others "Italicised".

I have searched and tried lots of things, so far all unsuccessful.  I thought this would be easy!

If anyone can help, i'd really appreciate it!  I copied the basic parts from a working email.  I'm just not getting my formatting (see my *** notes below).  I am pretty good at figuring out how to make my specifics work from a solution that has similar results, but I'm really stuck here.

Here's some of what I have so far:.  

<messaging:emailTemplate subject="New Instrument Ownership" recipientType="Contact" relatedToType="Class_Order__c">
<messaging:htmlEmailBody >

<html>
            <style type="text/css">
            body {font-family: arial; size: 12pt;}  *** I’m not getting Arial text; I’m getting Courier

            table {
            border-width: 5px;
            border-spacing: 5px;
           
            border-color: #FF0000;
            background-color: #FFFFFF;
        }

        td {
            border-width: 1px;
            padding: 4px;
            border-style: solid;
            border-color: #000000;
            background-color: #FFEECC;
        }

        th {
            color: #000000;
            border-width: 1px ;
            padding: 4px ;
            border-style: solid ;
            border-color: #000000;
            background-color: #FFFFF0;
        }
        </style>



<apex:image value="http://na15.salesforce.com/servlet/servlet.ImageServer?id=015i0000002yU39&oid=00Di0000000kwwg" />
<br/>
<br/>
Order Number: {!relatedTo.Name}


Dear {!RelatedTo.ChargentOrders__Billing_First_Name__c},
<br/>
This letter is to certify that {!relatedTo.Student_Name__c} is enrolled in: <br/>
        Class:  {!relatedTo.Class__c}<br/>  *** They want the variable “Class” BOLDed
        Days:  {!relatedTo.Days__c}<br/>  *** They want the variable “Days” BOLDed
<br/>
Thank you,<br/>
Your Counselor<br/>  ***  They want this text “Your Counselor” italicized.
<br/>
</html>
</messaging:htmlEmailBody>

Thanks!
Sara
  • October 13, 2014
  • Like
  • 0
Hi All,

actully i want to create email body in apex class. i already create it like this:

body='Hello';

But i want to define this body in more than one line.
Please help me.
I have a JSON feed  that i want to read and insert into Contact and Companies Object.

Its Very Large JSON Data. What is the best way to do it ? Shall i

1) Create some Sort of schedule in Salesforce?
2)  read chunk of data and insert/update?

Any code would be helpful

Here is my Json Feed url http://tinyurl.com/mpnb2fo
  • September 25, 2014
  • Like
  • 0
Hi @ all,
i have a Account with a relationship. The object is "Menu". Menu have "Master-Detail" to Account. One more object is "Menu item" This object have a "Master-Detail" to "Menu". Now I want to add the Liste of "Menu" at the Account Layout. This work without any problems. Now I want to add the "Menu Item" list in the list to "Menu" at the page layout from account.  The result should be that I can see all info at the account page to the menu and related menu items. Is this possible?

(I hope it is understandable, my english is not very good ;) )

Thanks,
​Lisa
In accont object we have two record types . While choosing one record type it needs to go standard page layout .But when user selecting second record type it needs to route to Custom VF . But  Here While users click on continue , it is not routing to custom VF. 

User-added image
Regards,
Raja.
  • December 09, 2016
  • Like
  • 0
How to write if clause in rerender tag



Thanks
Hi All,
I have a field level security requirement around custom formula. If the user does not have read access for the custom formula field at the profile level, User should not be abe to see the value at all in the custom Lightning component page / VF page but whenever i do security check in apex code for the field and assign any value to it then it is throwing error saying "formula fields are not writeable".

Please take a snap of my code as below:

List<hed__Course_Offering__c> courseOfferingList = [Select Id,Course_ID__c from hed__Course_Offering__c where hed__Term__c IN :termList ];
for(Integer i=0; i<spProgramDetail.courseOfferingList.size();i++){
// Course_ID__c is a FORMULA Field.    
 if (!Schema.sObjectType.hed__Course_Offering__c.fields.Course_ID__c.isAccessible()){
    courseOfferingList[i].Course_ID__c = '';
    }
}

Any help would be appreciated.

Regards,
Pawan Kumar
public class SecondExtension{
public Admin__c adminRecord;
public SecondExtension(ApexPages.StandardController stdCon){
adminRecord=(Admin__c)stdCon.getRecord();
}
public PageReference save(){ 

insert adminRecord;

PageReference pg=new PageReference('apex/PageConfirmation');

pg.sendRedirect(true);
}

public PageReference cancel(){

PageReference pg=new PageReference('/a09/o');
pg.sendRedirect(true);
}
}
 
Hi, I have been doing fairly simple validation rules but am having a Friday problem!

Essentially I am trying to create a validation rule on a custom object:

If a scheme name is set to a specific text string AND a picklist value is a certain value THEN display the error message - you cant save the record - the scheme name should be something other than CAP VG PH12.


AND( if ( CS_Scheme__r.Name," CAP VG PH12 "), AND( ISPICKVAL(Status__c , "filled"),null )
I know the above is not right but really would value some pointers.
thanks
 
Gurus, 
I have a very simple VF page. the output link on this page is not working.
Here is the VF page
<apex:page standardController="Quote" extensions="ReevaluateLimit"  sidebar="false">
  <h1>Reevaluate Limit</h1>
<apex:pageBlock >
<apex:pageBlockSection columns="1">
  <!-- Begin Default Content REMOVE THIS -->

  Only 18 Quote Items can be reevaluated.
  <apex:outputText value="/{!sQuoteId}"/>
   <apex:outputlink title="Back to Quote" value="/{!sQuoteId}"></apex:outputlink>
  <!-- End Default Content REMOVE THIS -->
 </apex:pageBlockSection>
 </apex:pageBlock>
</apex:page>

Below is the class
public class ReevaluateLimit {
 public Id sQuoteId {get;set;}
 public ReevaluateLimit(ApexPages.StandardController controller){
  sQuoteId=ApexPages.currentpage().getparameters().get('Id');
 }
}

I am able to get value of Id and it is displayed correctly on  apex:outputText

I just want to put a link on top of the page back to Quote

Regards, 
Gaurav

 
Hi, 
I wanted a custom Email send using Visual force page. End user picks the Template and Recepient .
How should i give preview of the Email before sending it.page

How can i show a preview of the Email being sent ?
I neeed to build a process to complete the following:

Read all records from an Object  (10000+ records)
Apply criteria to group the records by user and accumulate count fields
Insert the resulting records (User, Count) 

I dont believe I can use Batchable as I need to read all of the records before building the output records.
If this is possible, would I likely hit processing limits?

I was able to build this logic using a Java program and API calls, but have been asked if possible to build Salesforce job to do the same?
 
Hi, 
I am not able to complete Trailhead:Bulk Apex Triggers challenge ,I am facing  issue ' Challenge not yet complete... here's what's wrong: 
                                               Executing against the trigger does not work as expected'.  Debug logs are also not descriptive like error message.

Code :

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

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

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

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

(Custom_End_Date__c - today ())/30

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

Any assistance would be greatly appreciated.

Thank-you
Hello - I am attempting to create a formula that will allow us to build metrics on case turn around time.  The formula will output a number based off of the "status" picklist selection.
There are two picklist options that can trigger the formula and I am having trouble figuring out how to have one formula that references a picklist field be able to take action on more than one picklist option.  
Below is what I have;

IF(TEXT(ThinkLP__Status__c) = "Verified True Variance", NOW() - CreatedDate, NULL)
OR(
IF(TEXT(ThinkLP__Status__c) = "Verified False Variance", NOW() - CreatedDate, NULL)

I have tried a number of different variations to the formual to no avail...any help is appreciated.

Thank You,
Christopher
I created a custom button for the "leads" page so that our sales team can have a one-click follow-up created for various lengths of time.  The below button is for a 1 week follow-up and works just fine on the leads page:

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

var myTask = new sforce.SObject("Task"); 
myTask.WhoId = "{!Lead.Id}"; 
myTask.Subject = "{!Lead.LastName} 1 Month Follow-up"; 
myTask.status = "Not Started"
myTask.ActivityDate = "{!SUBSTITUTE(TEXT(TODAY()+30), "/", "-")}"
sforce.connection.create([myTask]); 
window.location.reload();

I would like to do something similar on our Opportunity and Case pages. I would expect that I could just swap out Lead.ID for Opportunity.ID and Lead.Lastname for the Opportunity.Subject and it should work.  Unfortunatly, I'm just getting a page refresh and no task.  Please help!
I wanted to spruce up the text on a commandButton by applying more than one CSS font class on the button label, but I get errors when I use tags inside the value parameter

Page Code:
<apex:commandButton styleClass="btnOrange" action="{!postTourQuizLink}"
value="What did you <font class='Papyrus'>Learn</font> about <font class='Papyrus'>Wildcats</font>? <font class='Afrika'>\</font>"
title="Take the post-Tour Quiz" immediate="false" />

I've also tried removing the value param and putting the label text between tags: <apex:commandButton>Label</apex.commandButton>

I tried creating a variable quizButtonTxt inside the postTourQuizLink function (on the extension ctrl) and then putting value="{!quizButtonTxt}", also not helpful. 

I'm a SF Admin/code hacker-modifier, and so I don't know enough to come up with a workaround- any suggestions? Special character references?

 
Hi there

I am relatively new to the development side of Salesforce.  I work in a middle school in NYC and the common database used is called ATS and is built on a Model 204 database system.  it is very very old and looks just like DOS.  I am now using Salesforce and built out (with limited knowledge) systems but we still have to keep this Model 204 database updated and its used to update Salesforce.  is there anyway to link the two somehow does anyone think?
Hello,

I am working on an application which displays markers on Goole maps. Info window of markers display person details such as name, address and phone number. When we click on name, detail page of person opens up which is working perfect. I want to have functionality that when we click on phone number, it should ask permission to dial that number just like it happens when you click phone number in salesforce 1.
 
Hello!

I have a question that I am pretty sure is an easy fix, only I can't seem to wrap my brain around the solution, so I am deferring to bigger brains than mine. :)

I have two formula fields. One calculates the number of months of a mission trip and the other returns a cost based on the number of months. what I need is a modification to one or both formulas that will return the cost for One month even if the dates calculate to Less than 30 days.

Here is the formula that caculates the length of time
(EndDate - StartDate +1)/30

Here is the formula that calculates the cost for the length of time:

STIMonths__c *CASE(TEXT(Country__c),"Argentina", 750.00,
"Bolivia", 625.00,
"Colombia",650.00,
"Costa Rica", 685.00,
"El Salvador", 685.00,
"Guatemala", 685.00,
"Tijuana, MX", 650.00,
"Tuxpan, MX", 650.00,
"Nicaragua", 685.00,
"Peru", 650.00, NULL)

Any guidance is hugely appreciated!
Hi All,

I'm running one time update using Execute Anonymous and getting error "Salesforce SOQL Error Too many SOQL 001" for the following code, I tried few options to change the code but couldn't run the update, anyone can help with this code please: (Opportuntiy is master for custom object Sales Team, 1 : M)

List <Opportunity> OpptySalesRep = [Select Id,Sales_Rep__c From Opportunity Where  Sales_Rep__c !=null and (CreatedDate > 2014-11-01T00:00:00Z and CreatedDate <= 2014-11-30T00:00:00Z)];    

    set<Id> opportunityIdSet = new set<Id>();
        for (Opportunity Oppty : OpptySalesRep) {
          
            list<Sales_Team__c> newGSTmember = new list<Sales_Team__c>(); 
           
            opportunityIdSet.add(Oppty.Id); //Needed for following SOQL for GST       

           //Query to get all Sales team memeber for the opportunity                    
           List <Sales_Team__c> gst = [Select Sales_Team_Member__c,Primary__c,Producer__c,Opportunity__c,Id
                                             From Sales_Team__c
                                             Where Opportunity__c  IN: opportunityIdSet and  Producer__c = null and Opportunity__c <> null];
                                        
                                             system.debug('Number of Sales Team Member# ' + gst.size());
            
            //Reset  opportunityIdSet for avoid duplicate iteration 
             opportunityIdSet.remove(Oppty.Id);
                           
            boolean IsnewSalesRep = true;  //to check if Sales Rep already exists in GST            
              
           // Loop through the list and update GST record that matches to Sales Rep
           for (Sales_Team__c OpptyGST : gst){
              system.debug('GST Memebr# : ' + OpptyGST.Sales_Team_Member__c);                        
              
              //Update Sales Rep to Primary
              if (OpptyGST.Sales_Team_Member__c == Oppty.Sales_Rep__c){
                  system.debug('INSIDE If');
                  OpptyGST.Primary__c = true;
                    IsnewSalesRep = false;
                }
              // Update Sales reps to non-primary
                else if (OpptyGST.Sales_Team_Member__c != Oppty.Sales_Rep__c && OpptyGST.Primary__c == true){
                  system.debug('INSIDE else If');
                  OpptyGST.Primary__c = false;
              }
                            
              }
            
            //Add Sales Rep to GST          
             if (IsnewSalesRep == true)
             {
             Sales_Team__c newGST = new Sales_Team__c (); //instantiate the GST object to put values
                          
            newGST.Sales_Team_Member__c = Oppty.Sales_Rep__c;
             newGST.Primary__c = true;
             newGST.Opportunity__c = Oppty.Id;
             newGSTmember.add(newGST);
             insert newGSTmember;
             
              }
           
              update gst;  
                         
           }