• Vishnu Vaishnav
  • SMARTIE
  • 757 Points
  • Member since 2014
  • Salesforce Developer


  • Chatter
    Feed
  • 11
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 88
    Replies

trigger posJobAppUpdate2 on Position__c(before update, before insert) {     
  if(className.firstTimeFlag == true) {     List<Job_Application__c> jobAppList = new List<Job_Application__c>();  
  if(Trigger.isUpdate)        jobAppList = [SELECT Id, position__c, status__c, stage__c FROM      Job_Application__c WHERE position__c IN :trigger.newMap.keySet()];     for(Position__c posRec : Trigger.new) {     
if(trigger.isUpdate) {     
    Position__c  oldPosRec = system.trigger.oldMap.get(posRec.Id);   
      if(oldPosRec.status__c == 'Open' && posRec.status__c == 'Closed') {         
    if(jobAppList != NULL && !jobAppList.isEmpty()) {            
     for(Job_Application__c jobApp: jobAppList) {              
       if(jobApp.position__c == posRec.Id) {                         jobApp.Status__c = 'Closed';                         jobApp.stage__c = 'Closed – Position Closed';            
         }       
             }
      
      }      
   }    
   }
}   
   system.debug('jobAppRecList after for loop--->' + jobAppList);     update jobAppList;          className.firstTimeFlag= false;     }      }
 
I have the following trigger, but it's not working as intended. There are no errors in the code.. any ideas?
 
trigger createCancellationReport on Opportunity (after update) {

    List<Win_Loss_Report__c> reportstoinsert = new List<Win_Loss_Report__c>();

    for (Opportunity opp : Trigger.new) {

        // Create cancellation report only for cancellation oppys
        if (opp.StageName == 'Closed Won' & opp.Cancellation_Reason__c != null) {
            Win_Loss_Report__c cr = new Win_Loss_Report__c();
            cr.Opportunity__c   = opp.id;
            cr.Name = 'Cancellation Report';
            cr.RecordTypeID = '012J00000009NC9';
            reportstoinsert.add(cr); // bulk process
        } 
    } 
}

 
  • January 27, 2015
  • Like
  • 0
Hi guys,

​I'm new to using visualforce as a way to customize Salesforce so I’ve started to use the visualforce workbook to help learn the limits, however, I seem to be getting stuck in tutorial #5 (using standard user interface components).
 
Below is what I’ve written (copied from pg18 in the workbook) but I get the error message - Unknown property 'account.contacts' referenced in Tutorial5
 
<apex:page>
<apex:pageBlock title="My Accounts Contacts">
<apex:pageBlockTable value="{!account.contacts}"var="item">
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
 
Has anyone else received the above error message or know why the above it incorrect?
 
Any help is greatly appreciated.
 
Kind regards,
Fiona 
Hi all,

I have been planning to write my certification for admin(201) next month.
Would appreciate if you guys could guide me abt material that would be most helpful in this regards

Thanks

Cheers! 
 
  • January 27, 2015
  • Like
  • 0
User-added image
In the above image i would like to add 3rd, 4th and so on upto 10 option on click of add option and implement reove link to remove perticular option(textarea) and if question type is descriptive i would like to hide all options
I would like to increase the size of the font and the font style. The sales staff have asked if this is possible? This page is something I borrowed from a lot of posts by many of the developers. 

here is my page code.

<apex:page standardController="Account" showHeader="True" sidebar="false" tabStyle="Account" >
      <style>
      .activeTab {background-color: #236FBD; color:white; 
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black; 
         background-image:none}
        </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab">
       <apex:tab label="Account" name="Account" id="tabaccount">
       <apex:detail id="account"/>
       </apex:tab>
      <apex:tab label="Reservation" name="Reservation" id="tabOpp">
         <apex:relatedList subject="{!account}" list="opportunities" />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
         <apex:relatedList subject="{!account}" list="OpenActivities" />
         </apex:tab>
         <apex:tab Label="Contract" name="Contract" id="tabContractAct">
         <apex:relatedList subject="{!account}" list="Contracts"/>
      </apex:tab>
     </apex:tabPanel>
</apex:page>

Hello, 
I'm hoping someone can help me with this trigger. Here's what it's supposed to do. If notes are added or updated to a text field called "Call Notes" on an opportunity, create a task. This trigger should run when an opp is created or updated.

If I remove "after insert", it seems to work just fine. However, when I add "after insert" I get the error "apex attempt to de-reference a null object: oppNotes".

trigger oppNotes on Opportunity (after insert, after update) {
     List<Task> taskList = new List<Task>();
      for (Opportunity opp : Trigger.new){
        Opportunity oldOpp = Trigger.oldMap.get(opp.Id);
         if (oldOpp.Call_Notes__c != opp.Call_Notes__c ) {
          Task t = new Task();
           t.subject = 'Call Notes';
            t.WhatId = opp.ID;
             t.Status = 'Completed';
            t.Priority = 'Normal';
           t.Type = 'Other';
          t.Description = opp.Call_Notes__c;
         taskList.add(t);
        }
       }
      insert taskList;
     }

Any help would be greatly appreciated. 

Hii,
In visualforce page, i want to do some DML operations. can i do that? if yes, How? give me small example.

Thank you..
 
Hi Team-

I would like to refer VisualForce Ids in jQuery using partial ID selector. Below is the code -
<apex:page id="page">
    <apex:form id="form">
        What is your name?
        <br/>
        <apex:inputText id="name" onfocus="myFunc()"/>
        <br/>
        What is your age?
        <br/>
        <apex:inputText id="ageText" onfocus="myFunc()"/>
    </apex:form>
    <apex:includeScript value="{!URLFOR($Resource.jQuery1_11, '/js/jquery-1.11.2.min.js')}"/>
    <script>
        function myFunc() {
            var j$ = jQuery.noConflict();
            var inputTextNameCatched = j$( 'input[id$=name]' ); //Find element with ID ending with name
            inputTextNameCatched.val('Sudipta Deb');
            var inputTextAgeCatched = j$('input[id$=Text]');
            inputTextAgeCatched.val('30');
        }
    </script>
</apex:page>
The above code is working perfectly fine. But when I am trying to get IDs starts with "age" with the below code - 
var inputTextAgeCatched = j$('input[id^=age]');
it is not working. Can anyone please help me to understand what is the problem? Thanks in advance.
Hi all,
when i modify an existing visualforce email template, the changes are applied on the UI. Now if i query for email template like this 

SELECT id, Body, HtmlValue, Name, DeveloperName, LastUsedDate, CreatedDate, Markup, ApiVersion FROM EmailTemplate WHERE Name = 'QuoteVFTemplate'

the HtmlValue returned is unchanged. However the Markup reflects the changes I made to the template on the UI.

Can someone please tell me why this could be happening or point me to  the right resource? Haven't been able to find any documentation around caching of Email templates.

The use case is, I want to get the HtmlValue of the template and render it on a Visualforce Page as pdf.

Thank you
Hi Ali,
I have a question. Please provide any suggestion. 
Why we can't Edit/update workOrders on the public site? Is there any way to access it.
I need to update workOrders from a VF page on a site.

Thanks
Hi All,
I have created one app. This app using a third party tool url. I have submitted this app  and got succesfully reviewed. but after some days i have  changed third party url, so do i need to resubmit app for review ?
Hi All,

I have made a app n i want to pulish in appexchange. my app will be cost free.
Please provide easy steps to upload app.My security reviews are clear also.

Thanks
i look all of my code and main thing is that its not same as Index out of Bounds:2 kind of err.
Hi Devs,

I make a component of lighting and add also in mobile navigation, but still its not showing in salesforce1.
my component here :
<aura:component controller="VKSoft_Light.ContactController" implements="force:appHostable">
  <div>Hello</div>
</aura:component>

I research lots of about it , and i got a link  :
http://salesforce.stackexchange.com/questions/53796/lightning-component-not-displaying-on-salesforce1-menu
Is it true on this link ?

 
Code is here :

global without sharing class PostInstallClass implements InstallHandler {
    global void onInstall(InstallContext context) {    
               
        User u = [Select Id, Email,name from User where Id =:context.installerID()];   
        List<String> toAddresses = new list<String>();
        toAddresses.add(u.Email);        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toAddresses);
        mail.setReplyTo('vishnukumarramawat@gmail.com');
        mail.setSenderDisplayName('My Package Support');
        mail.setSubject('Package install successful');
        mail.setPlainTextBody('Thanks for installing the package.');
        Messaging.sendEmail(new Messaging.Email[] { mail });
        
        //Send mail to developer whenever new user install it
        toAddresses = new list<String>();
        toAddresses.add('vishnukumarramawat@gmail.com');        
        mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toAddresses);
        mail.setReplyTo(u.Email);
        mail.setSenderDisplayName('Twins Package installed');
        mail.setSubject('New user install successful');
        mail.setPlainTextBody('Username : '+u.name + '\n' +'Email : ' + u.email);
        Messaging.sendEmail(new Messaging.Email[] { mail });
    }   
}
I need full of code fot it or any step by step process link ?

Thanks 
I got this error when i use salesforce connect offline 2.0.
Dear All,

   I am running the test class to see the code coverage i am getting "Unable to Process Request Concurrent requests limit exceeded"

please healp me to solve this problem.

thanks,
zabi.
I need full of code fot it or any step by step process link ?

Thanks 
I got this error when i use salesforce connect offline 2.0.
Hi,
I'm getting the below when i'm trying to update the record
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

Thanks in Advance

AT__c OOFRec =  new AT__c();
    public KB__c getOOFRec (){    
        List<AT__c> oofList = [select id, Details__c, Hide_Comments__c from KB__c where Context__c = 'IT Page' AND Title__c = 'Message2' limit 1];
        KB__c SupportOOF = new KB__c();
        if(oofList.size() > 0){ SupportOOF = oofList.get(0);
                   system.debug('tech supportOOF------'+techSupportOOF);}
        }
        return techSupportOOF;       
    }
    public void saveOOFRecord(){
            system.debug('tech supportOOF------'+OOFRecord);
            update OOFRecord;
    }
Hi All,

How to merge the Html td's dynamically based on the if condition in vf page .

Can anyone help me from this.

Thanks,
Sarvesh.

I am trying to execute callouts from my Triggers.

Ealier it was working fine.
Today I am seeing Callout in "Apex Job" as only Queued. Its not getting executed.

Can you please help me ?

Hi Experts,
Public void SendOrderEmail(){

        String Uname, ToAddress;
        String AccFirstName, AccLastName, ContFirstName, ContLastName; /* Added for UpperCase */        
        if(ConId==null && AId!=null){
            List<Account> acc = [SELECT First_Name__c, Last_Name__c, Email_Address__c  FROM Account WHERE Id = :AId limit 1];
            /* Added for UpperCase *******************************************Start*/
            AccFirstName = acc[0].First_Name__c;
            AccFirstName = AccFirstName.substring(0,1).toUpperCase() + AccFirstName.substring(1).toLowerCase();
            AccLastName = acc[0].Last_Name__c;
            AccLastName = AccLastName.substring(0,1).toUpperCase() + AccLastName.substring(1).toLowerCase();
            Uname = AccFirstName+' '+AccLastName;
            /* Added for UpperCase ********************************************End*/
           // Uname = acc[0].First_Name__c+' '+acc[0].Last_Name__c;
            ToAddress = acc[0].Email_Address__c; 
        }else{
          //  List<Contact> con = [SELECT Name, Email_Address__c  FROM Contact WHERE Id = :ConId limit 1];
          //  Uname = con[0].Name;
            /* Added for UpperCase *******************************************Start*/
            List<Contact> con = [SELECT FirstName, LastName, Email_Address__c  FROM Contact WHERE Id = :ConId limit 1];
            ContFirstName = con[0].FirstName;
            ContFirstName = ContFirstName.substring(0,1).toUpperCase() + ContFirstName.substring(1).toLowerCase();
            ContLastName = con[0].LastName;
            ContLastName = ContLastName.substring(0,1).toUpperCase() + ContLastName.substring(1).toLowerCase();
            Uname = ContFirstName+' '+ContLastName;
            /* Added for UpperCase ********************************************End*/
            ToAddress = con[0].Email_Address__c; 
        }
        
        String OrderAmt = String.valueOf(odr.TotalAmount);
        
        String EmailContent = '<table style="background: #E32237;color:#fff;">';
        EmailContent += '<tr><td colspan=2 style="padding-bottom:10px;font-weight:bold;">Cher '+Uname+',</td></tr>';
        EmailContent += '<tr><td colspan=2 style="padding-bottom:5px;">'+Label.Order_Summary_Page_Success_Message+'</td></tr>';
        EmailContent += '<tr><td style="font-weight:bold;">'+Label.Order_Summary_Order_Number+'</td><td>'+odr.OrderNumber+'</td></tr>';
      //  EmailContent += '<tr><td style="font-weight:bold;">'+Label.Order_Summary_Seasonal_Offers+'</td><td>'+odr.Seasonal_Offers__c+'</td></tr>';
      //  EmailContent += '<tr><td style="font-weight:bold;">'+Label.Order_Summary_Permanent_Offers+'</td><td>'+odr.Permanent_Offers__c+'</td></tr>';
        EmailContent += '<tr><td style="font-weight:bold;">'+Label.Order_Summary_Order_Amount+'</td><td>'+OrderAmt.replace('.',',')+'€</td></tr>';
        EmailContent += '<tr><td style="font-weight:bold;width: 35%;">'+Label.Order_Summary_Status+'</td><td style="width: 65%;">Commande reçue</td></tr>';
        EmailContent += '<tr><td colspan=2 style="padding:10px 0 3px;font-weight:bold;">'+Label.Order_Summary_Page_Order_Products+'</td></tr>';
        EmailContent += '<tr><td colspan=2 style="padding-bottom:10px;"><table style="color:#fff;border-collapse: collapse;border-spacing: 2px;" border=0>';
        EmailContent += '<tr style="font-weight:bold;background:#B50E20;"><td style="padding:5px">'+Label.Order_Summary_Page_Product+'</td><td style="padding:5px">'+Label.Order_Summary_Page_Product_Code+'</td><td style="padding:5px">'+Label.Order_Summary_Page_Quantity+'</td><td style="padding:5px">'+Label.Order_Summary_Page_Unit_Price+' (€)</td><td style="padding:5px">'+Label.Order_Summary_Page_Total_Price+' (€)</td></tr>';                
        for(OrderItemWrapperClass oi : OrderItemWrapperList){
            String Qty = String.valueOf(oi.Qty);
            String Prce = String.valueOf(oi.Prce);
            String Ttl = String.valueOf(oi.Ttl);
            EmailContent += '<tr style="color:#000;font-size:13px;background:#fff"><td style="padding:5px">'+oi.Prod+'</td><td style="padding:5px">'+oi.PCode+'</td><td style="padding:5px;text-align:right;">'+Qty.replace('.',',')+'</td><td style="padding:5px;text-align:right;">'+Prce.replace('.',',')+'</td><td style="padding:5px;text-align:right;">'+Ttl.replace('.',',')+'</td></tr>';                
       
        }
        String freeSeasonalProduct = String.valueOf(odr.Seasonal_Free_Product__c);
        String freePermanentProduct = String.valueOf(odr.Permanent_Free_Product__c);
        String freeSeasonalQuantity = String.valueOf(odr.Seasonal_Offers__c);
        String freePermanentQuantity = String.valueOf(odr.Permanent_Offers__c);
        
        if((freeSeasonalQuantity != null && Integer.valueOf(freeSeasonalQuantity) != 0) || (freePermanentQuantity != null && Integer.valueOf(freePermanentQuantity) !=0)){
            EmailContent += '</table><tr><td colspan=2 style="padding:10px 0 3px;font-weight:bold;">'+Label.Order_Summary_Page_Free_Products+'</td></tr>';
            EmailContent += '<tr><td colspan=2 style="padding-bottom:10px;"><table style="color:#fff;border-collapse: collapse;border-spacing: 2px;" border=0>';
            EmailContent += '<tr style="font-weight:bold;background:#B50E20;"><td style="padding:5px">'+Label.Order_Summary_Page_Product+'</td><td style="padding:5px">'+Label.Order_Summary_Page_Product_Category+'</td><td style="padding:5px">'+Label.Order_Summary_Page_Quantity+'</td></tr>';                                 
            
            if(freeSeasonalQuantity != null && Integer.valueOf(freeSeasonalQuantity) != 0){
            EmailContent += '<tr style="color:#000;font-size:13px;background:#fff"><td style="padding:5px">'+freeSeasonalProduct.replace('.',',')+'</td><td style="padding:5px">'+Label.Order_Summary_Seasonal_Offers+'</td><td style="padding:5px;text-align:left;">'+freeSeasonalQuantity.replace('.',',')+'</td></tr>';                
            }
            if(freePermanentQuantity != null && Integer.valueOf(freePermanentQuantity) !=0){
            EmailContent += '<tr style="color:#000;font-size:13px;background:#fff"><td style="padding:5px">'+freePermanentProduct.replace('.',',')+'</td><td style="padding:5px">'+Label.Order_Summary_Permanent_Offers+'</td><td style="padding:5px;text-align:left;">'+freePermanentQuantity.replace('.',',')+'</td></tr>';                
            }
        }      
        EmailContent += '</table><tr><td colspan=2 style="padding-bottom:10px;"><a style="color:#fff;" href="'+Label.Order_Page_Domain_Name+'/OrderCreation?id='+AId+'&cid='+ConId+'">'+Label.Order_Summary_Page_Click_Here+'</a> '+Label.Order_Summary_Page_Clickhere_Message+'</td></tr>';
        EmailContent += '<tr><td colspan=2 style="font-weight:bold;">'+Label.Order_Summary_Page_Thanks+',<br/>'+Label.Order_Summary_Page_Mars_Chocolate+' </td></tr>';
        
        EmailContent += '</table>';    
        
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setToAddresses(new String[] { ToAddress });
        email.setSubject(Label.Order_Summary_Subject); 
        email.setHTMLBody(EmailContent);
        
        Messaging.sendEmail(new Messaging.Email[] { email });
                
    }
In the output, I am getting an email in which I am unable to change the email displayed in From field.

For example:
From: Order Summary Site Guest User to you <xyz@gmail.com>
Date: Wed, Jan 28,2015 at 5.24 PM
Subject: Sandbox: Order Summary
Using setSenderDisplayName, setReplyTo, I am able to change "Order Summary Site Guest User to you" part, not "xyz@gmail.com". Is there any way to change the email address appearing by default.
 
Hi,

I have some customers that work in the same bussines category: insurance. I have a org (Professional edition) and I want to clone it many times because I don't want rewrite every time the changes.

What is the best way to solve this?
Hi,

So I'm creating a VF page. There is a coustom object called XYZ. Its has a picklist Field abc. I want to display abc as picklist value on my page. What will the code be in the class. Please help.
  • January 28, 2015
  • Like
  • 0
I am trying to add a Class to a Input Field in Visual Force but when the page is rendered it removes the styleClass Attribute. This inputField is a dependant Picklist.

Below is my VF Code
<apex:inputField value="{!configTaskToUpdate.Config_Category__c}" styleClass="form-control" id="thecategory"/>

i have tried adding the the code to a div tag around it but it comes out akward

I have also tried adding it to the the field by jQuery as below but that doesnt work either
$(document).ready(function() {
                    $(function() {
                        $("#{!$Component.theform.thecategory}").addClass("form-control");
                        console.log('added the form-control class');
                    });
                });

Anyone have this issue and or found a workaround or is SF working on it?
Hi, I am trying to write a trigger to call a btach class if a check box is true, otherwise call the future class. but IDK what is wrong with my code I can't save it. please advise. here is my code:

trigger ProjectSettings_ChartsTrigger on Project_Setting__c (After Insert,After Update){
    
    List<id> ProjectIds = new list<id>();
    List<Project_Setting__c > prj = [select Id, total_check__c from Project_Setting__c where Id In : ProjectIds];
    for(Project_Setting__c PS : Trigger.new){
    if (Project_Setting__c.total_check__c = true) {
      ProjectIds.add(PS.id);   
    }
    ProjectSettings_ChartsBatchClass pro = new ProjectSettings_ChartsBatchClass(); 
              database.executebatch(pro,2000);
} if (Project_Setting__c.total_check__c = false){
     projectSettingsChartClass.ProjectMethods(ProjectIds);
    }
    

Thanks
I'm trying to create a custom button that pre-populates an Opportunity with certain values.  I'd like to have the button go straight to the new opportunity screen, and bypass the Record Type selection screen.

I've poured through quite a few posts, and the advice is always add"&RecordType=RecordType.Id", but I already have that in the URL, and it doesn't seem to help.

URL I'm using:
/setup/ui/recordtypeselect.jsp?
ent=Opportunity
&RecordType=012A0000000r2ROIAY
&retURL=%2F{!Contact.Id}
&save_new_url=%2F006%2Fe%3Flookupcmpgn%3D1%26retURL%3D%252F{!Contact.Id}%26accid%3D{!Account.Id}%26conid%3D{!Contact.Id}
(...)

Where am I going wrong?

 

trigger posJobAppUpdate2 on Position__c(before update, before insert) {     
  if(className.firstTimeFlag == true) {     List<Job_Application__c> jobAppList = new List<Job_Application__c>();  
  if(Trigger.isUpdate)        jobAppList = [SELECT Id, position__c, status__c, stage__c FROM      Job_Application__c WHERE position__c IN :trigger.newMap.keySet()];     for(Position__c posRec : Trigger.new) {     
if(trigger.isUpdate) {     
    Position__c  oldPosRec = system.trigger.oldMap.get(posRec.Id);   
      if(oldPosRec.status__c == 'Open' && posRec.status__c == 'Closed') {         
    if(jobAppList != NULL && !jobAppList.isEmpty()) {            
     for(Job_Application__c jobApp: jobAppList) {              
       if(jobApp.position__c == posRec.Id) {                         jobApp.Status__c = 'Closed';                         jobApp.stage__c = 'Closed – Position Closed';            
         }       
             }
      
      }      
   }    
   }
}   
   system.debug('jobAppRecList after for loop--->' + jobAppList);     update jobAppList;          className.firstTimeFlag= false;     }      }
 
User-added image
In the above image i would like to add 3rd, 4th and so on upto 10 option on click of add option and implement reove link to remove perticular option(textarea) and if question type is descriptive i would like to hide all options
In my website I am querying more than 10 images from Attachments to show it in the page. Among these images, only one will be the main image and all others will be thumbnails. What I am doing right now is after querying the attachments, I have given specific size to the thumbnail and main image. This query generates more than 85% data of the site. Is there any way I can minimize the image size(by using code) or can I do anty modifications on the query so that I could reduce the site data. All suggestions are welcome.
hi All,
 I am working on test class every day, but by end of the day, i need to prepare xls sheet, like which class pass or failed, if pass what is code coverage like that,  so is there ant tool or easy methodalogy to get all class list with their code coverage and lines of covered .
please let me know if know any one, it's greate help to me.

Thanks. 
 
  • December 16, 2014
  • Like
  • 0

I'm using several hierarchy type custom settings in an application.  When upload the package in as UNMANAGED, all is fine.  However, when I try to install the package, I get an error.  I tried to install the contents of the same package using the Force.com IDE, it errors out.  I am able to trace the errors to references to the custom settings in the formulas.  These references show the namespace prefix from the source package.  I would presume once I convert this to a managed package, I will not get these errors.  However, I also need to install it an unmanaged.

Does anyone know how to remove references to the namespace prefixes for custom settings in a formula?  I have tried to edit the formula directly from the Force.com IDE.  When I save, the namespaces are automatically put back in.  I am beginning to believe that I will have to remove ALL the formulas and apply the changes manually.

  • August 09, 2010
  • Like
  • 0