• Arun Deepan LJ
  • NEWBIE
  • 110 Points
  • Member since 2014
  • Salesforce Developer
  • KVP Business Solutions


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 32
    Replies
Hello,

I have a trigger, which has future method in it.
This future method updates the fields or the trigger object.

I want to implement something which will refresh the part of the page , after the end of future method.

 
  • December 01, 2015
  • Like
  • 0
Hello,

I have a text field on the page layout.

I made that text field read only in field level setting and also in Page layout.

I a still able to modify this record
  • December 01, 2015
  • Like
  • 0
I have configured Email to Salesforce. When ever I sent any email, from my configured email, with BCC as EmailToSalesforce id, the task is getting three times in the Lead.
Any idea, why task getting created three times, instead of one time. 
For every lead, this is happening.
Hi, I am calling an Update DML call, inside future method, with dmo.assignmentRuleHeader.useDefaultRule = true; but when the future context executes, the lead assignment rules are not triggered in production. But in sandbox, it is triggering/working fine! any suggestion?
I have a workflow, that sends an email alert to the lead owner, when ever the criteria is met.
The problem is, I checked with debug that, workflow is called and criteria is also met and email template is also available.
But, I am not getting any email. 
I am trying in the Sandbox .
What  will be the issue?
Hi,
When an approval process is created, and submitted for approval, by default the record will be locked.

My requirement is, I don't want the record to be locked, when submitted for the approval. how can I obtain this
Hi,
In a custom object, I have two DateTime fields such as From Time and To Time. It is provided to specify the time shift interval such as morning 9.00 Am to Evening 2.00 Pm, and another shift 2.00 Pm to 10.00 PM.  But the problem, there is a shift which be like night today 10.00 PM to next day morning 7.00 AM. Based on the current execution time, it needs to select the exact record matching the shift. There can be multiple shift with multiple timings.

I am considering only the time part of both the fields. 
currently what I used is,
System.now() >  fromTime__c && system.now() < toTime__C

But in this, the shift from, night 10.00 PM to morning 7.00 AM cannot be matched with this.

 
Hi,
How custom labels can be used in the picklist. While creating a picklist field, can we directly refer the values from the Custom labels?. I know about the translation settings, but what I want, I don't want the picklist values to be hardcoded, since the picklist value is referred in Apex coding in multiple place. And Hence, a change in Picklist means, I have change every where in the code. What is the best solution to such scenario?
 
Hi, 
In the before insert context, the IDs are not yet assigned to the list. In such scenario, If I need to create a map to uniquely access each record. What is the best way. Cannot depend on the field values.
Currently, the quick start wizard is showing the Navigation Menu, where only standard functionalities are there. Custom app or object is not visible.
Again in global actions, can add any custum action. and compact layout, its showing only for the Contact object. How to customize for the custom objects. 
I have a workflow, that sends an email alert to the lead owner, when ever the criteria is met.
The problem is, I checked with debug that, workflow is called and criteria is also met and email template is also available.
But, I am not getting any email. 
I am trying in the Sandbox .
What  will be the issue?
Hello guys.I have a problem and dont know how to solve it.What i need to make is to split account creation page in 3-4 visualforce pages.Now i created the first page and linked it with a second page with a button.But now the problem is when i press the "next" button on the first page account is created, and the fields in the second page are not recorded anywhere when i push the "next" button(on the second page). I dont know how to update the account that was created on the first page with the values that i enter in the second page so here is the code:
this is my custom controller:
public class SetupWizard {
public Account account {get;private set;}
     
    public SetupWizard(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        account = (id == null) ? new Account() : 
            [SELECT Name, Phone, Industry FROM Account WHERE Id = :id];
    }
   
    public PageReference save() {   
            try{
                upsert account;
                }catch(exception e){
                }
                PageReference page = new Pagereference('/apex/AddressInformation');
            page.setRedirect(true);
            return page;
 }
}
and this is the first visualforce page:
<apex:page sidebar="false" controller="SetupWizard" tabStyle="Account">
    <apex:form >
        <apex:pageBlock title="Account Information" >
            <apex:pageBlockSection columns="2">
                <apex:inputField value="{! Account.name }" />
                <apex:inputField value="{! Account.phone}" />
                <apex:inputField value="{! Account.industry}" />
                </apex:pageBlockSection>
                
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Next" 
                                    action="{! save }"/>    
            </apex:pageBlockButtons>
           </apex:pageBlock>
    </apex:form>
</apex:page>
So how to make when press the next button on the second page it updates the account created on the first page with the records that are eneterd on my second page.Any help would be nice thx.

 
Can anyone tell me how to create a checkbox in picklist using Apex and Visualforce page . As per my knowledge  in Apex will create a list of

I want this Functionality
selectOption and this will accept only string ,this selectOption will pass to the visualforce selectoption but how to add checkbox .As per the above image i need to add string along with checkbox in my picklist
Hi,
When an approval process is created, and submitted for approval, by default the record will be locked.

My requirement is, I don't want the record to be locked, when submitted for the approval. how can I obtain this
Hi Everyone,

I have create a vf page and custom controller .page contains 2 input to take user inputs.when user gives values and saves the record using custom button.once it is saved i need to send that page vf page as attachment in pdf format to the mail what we have speciefied in vf page.
here i'm pasting my code.please corrrect my code.
VF PAGE:
---------------------

<apex:page controller="sendingMailAttachment"> <apex:form > <apex:messages /> <apex:outputLabel >Name</apex:outputLabel>&nbsp; &nbsp; &nbsp; <apex:inputText value="{!name}"/><br/> <apex:outputLabel >Mail</apex:outputLabel>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <apex:inputText value="{!cmail}"/><br/> <apex:commandButton action="{!Submit}" value="Submit"/> </apex:form> </apex:page>
controller:
-----------
public class sendingMailAttachment {

    public String cmail { get; set; }

    public String name { get; set; }
   
    public sendingMailAttachment (){}
    public pagereference Submit(){
    
    contact Conval=new contact();
    conval.lastname=name ;
    conval.Email=cmail ;
    insert conval;
    
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'contact inserted');
        ApexPages.addMessage(myMsg); 
        
        
        
        // Reference the attachment page and pass in the  ID
        PageReference pdf =  Page.emailAttachmentEx1;
       pdf.getParameters().put('id',conval);
        // Take the PDF content
        Blob b = pdf.getContentAsPDF();
        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setContentType('application/pdf');
        efa.setFileName('attachment.pdf');
        efa.setInline(false);
        efa.setBody(b);
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {conval.Email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('New contact is created'); 
        
        mail.plainTextBody = 'Name : '+conval.lastname+'\n'+'Mail Id : '+conval.email;
        
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
        return null;
    }
    
}
---
above code is sending attachment with just labels. i want the inputs user give along with labels.

Thanks
Lakshman
 
Hi,
In a custom object, I have two DateTime fields such as From Time and To Time. It is provided to specify the time shift interval such as morning 9.00 Am to Evening 2.00 Pm, and another shift 2.00 Pm to 10.00 PM.  But the problem, there is a shift which be like night today 10.00 PM to next day morning 7.00 AM. Based on the current execution time, it needs to select the exact record matching the shift. There can be multiple shift with multiple timings.

I am considering only the time part of both the fields. 
currently what I used is,
System.now() >  fromTime__c && system.now() < toTime__C

But in this, the shift from, night 10.00 PM to morning 7.00 AM cannot be matched with this.

 
Hi,

  I wrote below trigger on opportuntiy to update account field for some reasons it is not workng please suggest me what is the issue in below trigger
trigger update_account_billing_email  on Opportunity (before insert, before update) {

 for(Opportunity opp:System.Trigger.new) 
  { 
    
   Opportunity op = [SELECT Billing_ContactEmail__c,AccountId from Opportunity 
                      where id in :Trigger.newMap.keySet()];

   Account ac = [SELECT Billing_Email__c from Account where id = :op.AccountId];
   
   If ( ac.Billing_Email__c == '')
   {
     ac.Billing_Email__c = op.Billing_ContactEmail__c;
     
     update ac;
    }
   

  } 



}

Thanks
Sudhir
Hi All,

In Contact Object, Acivity History related list having Log a Call Button. When i click on Button then open a page and prepopulate some fields like Assigned To, Priority and Related To etc.. But here my problem is that "Related To" field(Picklist) is prepopulated with Opportunity object, Now i want to change that as "Patient" custom object.
Related To field having some values like Asset, Campaign, Case, Contact,Patient,Opportunity etc..

Can i change that field value ? Please let me know with appropriate solution.

Thanks
Rakesh
Hi techi's,

Please solve this issue

constructor;
try
        {
            orderDetails = (OrderItem)controller.getRecord();
            system.debug('orderdetails'+orderdetails);
            orderDetails = [select id,Stage__c,OrderItemNumber,Quantity from OrderItem where id=:orderDetails.Id];
            Production = new Production_Stage__c();
            Production.Order_Product__c = orderDetails.id;
            system.debug('inputstatus is '+inputstatus);
            productionStageMap=new Map<String,Decimal>();
            productionStageSeqMap=new Map<Decimal,String>();
            
            Map<String,ProductionStage__c> tempMap = ProductionStage__c.getAll();
            
            for(String stageName : tempMap.KeySet())
            {
                if(tempMap.get(stageName)!=null)
                {
                    ProductionStage__c tempObj =tempMap.get(stageName);
                    productionStageMap.put(tempObj.Name,tempObj.Sequence_Number__c);
                    productionStageSeqMap.put(tempObj.Sequence_Number__c,tempObj.Name);
                }
            }
            system.debug('productionStageMap ' + productionStageMap);
            system.debug('productionStageSeqMap ' + productionStageSeqMap.keySet());
        }
        catch(exception ex)
        {
            system.debug('mesg '+ ex.getLineNumber() +'  no '+ex.getMessage());
        }
Method :
 public PageReference saveAndnew()
    {
        
        system.debug('The entered production object is ' + Production );
        system.debug('The input stage is ' + inputstatus);   
        system.debug('The production stages are ' + productionStageMap );
        
        PageReference pr;
        
        decimal Quantity = Production.Quantity__c;
        Production_Stage__c previousProductionstages = new Production_Stage__c();
        decimal completedquantity=0;
        decimal DateQty;
        decimal stageqty=0;
        decimal qty=0;
        decimal quan;
        decimal tqty;
        List<decimal> ldec;
        set<string> stageName=new set<string>();
        List<Production_Stage__c>  ProdMap;
        List<Production_Stage__c> stagelist = [select id,Quantity__c,Stage__c from Production_Stage__c where Stage__c=:inputstatus and Order_Product__c =:orderDetails.id];//stagelist here am getting null value&&inputstatus is null
        system.debug('stagelist is'+stagelist);
        
        for(Production_Stage__c ps : stagelist)
        {
            system.debug('Production Qty is'+Production.Quantity__c);
            qty= qty+ps.Quantity__c;
            //stageqty= Production.Quantity__c+quan;
            //completedquantity=stageqty+Production.Quantity__c;
        }
        
        quan = qty+Production.Quantity__c;

Mytest class:
 Production_Stage__c pstage2=new Production_Stage__c();
        pstage2.Date_In__c=system.today();
        pstage2.Date_Out__c=date.newInstance(2015,12,20);
        pstage2.Order_Product__c=oi.id;
        pstage2.Stage__c ='Schedule';
        pstage2.Sequence_Number__c=1;
        pstage2.Quantity__c=5;
        insert pstage2;
        system.debug('SSSSSSS'+pstage2);
        //insertion of custom settings
      
         
        ProductionStage__c ps1=new ProductionStage__c();
        ps1.Name=pstage.Stage__c;
        ps1.Sequence_Number__c=1;
        insert ps1;
       
        system.debug('ProductionStageps1'+ps1);
        
        PageReference pageRef = Page.ProductionProcessVf;
        test.setCurrentPage(pageRef);
        ApexPages.StandardController con = new ApexPages.StandardController(oi);
        system.debug('CCCCCCCCCon'+con);
        
         
        Production_Controller proc= new Production_Controller(con);
        system.debug('CCCCCCCCCon'+proc);
        
      
        proc.inputstatus='PreProcessing';
        proc.getstatusOptions();
        proc.saveAndnew();//Here getting Null pointer Exception 
        proc.cancel();
can any one help?
Hi,

I have a picklist with 6 values (1, 2, 3, 4, 5, 6)

The default value is 1.

When someone chooses another value from that picklist (imagine 2), I would like that value 1 and 2 were not able to be picked again.

How can I do this?

Thanks
Hi,
How custom labels can be used in the picklist. While creating a picklist field, can we directly refer the values from the Custom labels?. I know about the translation settings, but what I want, I don't want the picklist values to be hardcoded, since the picklist value is referred in Apex coding in multiple place. And Hence, a change in Picklist means, I have change every where in the code. What is the best solution to such scenario?
 
Hi, 
In the before insert context, the IDs are not yet assigned to the list. In such scenario, If I need to create a map to uniquely access each record. What is the best way. Cannot depend on the field values.
Hello,

I have a trigger, which has future method in it.
This future method updates the fields or the trigger object.

I want to implement something which will refresh the part of the page , after the end of future method.

 
  • December 01, 2015
  • Like
  • 0
Hi,
iam trying to delete the records using vf pages but can't delete.It not display any errors but no result.Tell me the suitable Answer

My code is
VF Page:
<apex:page standardController="contact" extensions="deletemultiplecont" recordSetVar="contacts" >
    <apex:form id="frm">
          <apex:pageblock id="pgblk">
         
           <table class="list " border="0" cellpadding="0" cellspacing="0">
           <tr class="headerRow" >
              
              <th class="headerRow"> Action </th>
              <th class="headerRow"> Name </th>
              <th class="headerRow"> MailingCity </th>
              <th class="headerRow"> Phone </th>
           </tr>
          <th> <apex:repeat value="{!contacts}" var="cont">
           <tr class="dataRow">
               
                <td class="dataCell"> <apex:commandlink value="delete" action="{!delmultplerec}" oncomplete="location.reload();">
                   <apex:param value="{!cont.id}" name="Id"/> 
                 </apex:commandLink> </td>
               
              <td class="dataCell"> <apex:outputText value="{!cont.Name}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.MailingCity}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.phone}"/> </td>  
             
           </tr>
           </apex:repeat> </th>
           
        </table>
                 
      </apex:pageblock>
    </apex:form>

</apex:page>

Controller Class:

Public with sharing class deletemultiplecont
{
  public string Name{set;get;}
  public string Phone{get;set;}
  public string MailingCity{get;set;}
  public string asgn{get;set;}
  public contact cdel = new contact();
 
 public deletemultiplecont(apexpages.standardsetcontroller setcon)
  {
  
  }
  
  Public pagereference delmultplerec()
  {
        Id contactId = apexpages.currentpage().getParameters().get('Id');
        system.debug('hidden val is..!!' +asgn);
        try
            {
            
            cdel = [select id from contact where id =: contactId];
            system.debug('delete rec is..!!' +cdel);
            delete cdel;            
            return NULL;
            }
             catch(exception e)
             {
                System.debug('The following exception has occurred: ' + e.getMessage());
                return NULL;
             } 
  }
}

Regards
Galeeb SK