• SivaG
  • NEWBIE
  • 259 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 50
    Replies
Hi,

Just wondering why debug logs are getting deleted auotmatically after it shows up in logs. Here is the situation,
We are trying to run some  unit tests ,we can see the log is recorded but in few seconds it just disappears (No one is deleting it). Is it a standard behavior? or storage issue?  Any help would be greatly appreciated
Hi, 

  In visual force page we are displaying picklist with Yes or No Option we need to make No as a default view on visual force page. Please suggest how to make the change on this code 
 
<apex:outputLabel value=" Renewal Opportunity" for="RenOpp"/> 
          <apex:selectList value="{!RenewalOpportunity}" multiselect="false" size="1">
             <apex:selectOptions value="{!RenewalOpp}" />
          </apex:selectList>

Thanks

Sudhir


 

Hi,

Use case - User will click the button and a popup to show "Select a picture to upload either from Photo Gallery or use Camera".
In case of mobile/table, on click of a button a popup to show "Select a picture to upload either from Photo Gallery or use Camera".
In case of desktop/laptop with webcam, on click of a button a popup to show "Select a picture to upload either from Computer or use Camera".
In case of desktop/laptop without webcam, on click of a button a popup to show "Select a picture to upload either from Computer".

My requirement is to capture an image through webcam(integrated(laptop) or external(laptop/desktop)) or mobile camera(Salesforce1) whenever a button is clicked on the visual force page. I have used html tags(<video> and <input>) but the problem is the webcam(laptop) is enabled by default(autoplay) even after I remove the autoplay attribute. 

Question - Can the webcam be controlled by a button in visual force page i.e on or off ?

Code I used - 

<apex:page controller="Photoupload1" showHeader="false" sidebar="false">
<html>
    <head>
        <script src="https://localhost/cordova.js"></script>
        <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" ></script>
        
        <style>
        #wrapper {
      width:1600px;
      clear:both;
    }
        #first {
          width:800px;
          float:left;
        }
        #second {
          width:800px;
          float:left;
        }
        </style>
  </head>

           <title>Webcam</title>
<div  style="background-color:#FFF">
    <div  style="padding-top: 2%;padding-bottom: 1%;">
        <div class="col-md-2 col-md-offset-3" >
            <button class="btn btn-primary" style="margin-top:10px" id="snap" >Capture</button>
            <button class="btn btn-primary" style="margin-top:10px;display:none" id="new">Retake</button>    
            <button class="btn btn-primary" style="margin-top:10px;display:none" id="upload">Upload</button>
        </div>


        <div >
            <select class="form-control" style="margin-top:10px;display:none" id="videoSource"></select>
        </div>

    </div>
    <div style="padding-top: 2%;padding-bottom: 1%;" >
        <div align="center">
            <canvas id="canvas" style="display:none;width:10%;height:10%;"></canvas>
            <video class="myvideo" id="video" autoplay="autoplay" style="background-color: white;width:15%; height:15%;"></video> 
            <input id="video" type="file" accept="image/*;capture=camera"/>
        </div>
    </div> 

    <div id="el_loading" style="display:none;position: fixed;top:0;background-color: #fbfbfb; height:100%;opacity:0.65;width:100%;">
        <div  style="top: 50%; width: 91px;  margin: 20% 47%;"> 
            <img  src="/img/loading.gif" title="Please Wait..."/>
            <span>Saving...</span>
        </div>
    </div>  
</div>

<script>

function hideTheBoxComponent(){
        $("#myModal1").modal('hide'); 
    }

    function showDialogComponent(){
        $("#myModal1").modal({
          "backdrop"  : "static",
          "keyboard"  : true,
          "show"      : true 
        });
    }

    // Put event listeners into place
    window.addEventListener("DOMContentLoaded", function() {

        // Grab elements, create settings, etc.
        var canvas = document.getElementById("canvas"),
            context = canvas.getContext("2d"),
            video = document.getElementById("video"),
            videoObj = { "video": true },
            errBack = function(error) {
                console.log("Video capture error: ", error.code); 
            };

        // Capture Snap Photo
        document.getElementById("snap").addEventListener("click", function() {
            canvas.width = video.videoWidth;
            canvas.height = video.videoHeight;
            context.drawImage(video, 0, 0);
            // Littel effects
            $('#video').hide();
            $('#canvas').show();
            $('#snap').hide();
            $('#new').show();
            $('#upload').show();
        });

        // Capture New Photo
        document.getElementById("new").addEventListener("click", function() {
            $('#video').show();
            $('#canvas').hide();
            $('#snap').show();
            $('#new').hide();
            $('#upload').hide();
        });



    }, false);

    'use strict';

 var videoElement = document.querySelector("video");
 var videoSelect = document.querySelector("select#videoSource");
 navigator.getUserMedia = navigator.getUserMedia ||
 navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

 function gotSources(sourceInfos) {
    for (var i = 0; i != sourceInfos.length; ++i) {
        var sourceInfo = sourceInfos[i];
         var option = document.createElement("option");
          option.value = sourceInfo.id;
         if (sourceInfo.kind === 'video') {
           option.text = sourceInfo.label || 'camera ' + (videoSelect.length + 1);
           videoSelect.appendChild(option);
              if( i == sourceInfos.length - 1 ) {
              option.selected = true;
               }
        } else {
            console.log('Some other kind of source: ', sourceInfo);
        }
     }
     start();
   }

   if (typeof MediaStreamTrack === 'undefined') {
    alert('This browser does not support MediaStreamTrack.\n\nTry Chrome Canary.');
   } else {
    MediaStreamTrack.getSources(gotSources);
   } 


   function successCallback(stream) {
    window.stream = stream; // make stream available to console
    videoElement.src = window.URL.createObjectURL(stream);
    videoElement.play();
   }

   function errorCallback(error) {
    console.log("navigator.getUserMedia error: ", error);
   }

    function start() {
    if (!!window.stream) {
        videoElement.src = null;
        window.stream.stop();
    }

    var videoSource = videoSelect.value;

    var constraints = {
        video: {
            optional: [{ sourceId: videoSource}]
       }
    };
    navigator.getUserMedia(constraints , successCallback, errorCallback);
    }
 </script>   
 
     
        <apex:form > 
             
             
     <apex:actionRegion >
    <apex:actionFunction action="{!saveImage}" name="saveImage" rerender="dummy">
    <!--<apex:actionFunction name="saveImage" rerender="dummy">-->
        <apex:param name="imageBase" assignTo="{!imageBase}" value="" />
    </apex:actionFunction>
    <apex:outputPanel id="dummy"/>
</apex:actionRegion>


  </apex:form> 

</html>
</apex:page>
  • August 04, 2016
  • Like
  • 0
Hi,

I have a requirement to capture an image in visual force page either from computer or through Camera(Webcam/phone camera/tablet camera). What all frameworks/technologies that we have to implement in visual force page to accomplish this.

Thanks
Siva
  • July 21, 2016
  • Like
  • 0
Hi,

Can I initiate Mail merge function from a flow(Visual Workflow)? If so, what are the steps/proccess?

Thanks
Kumar
  • February 26, 2016
  • Like
  • 0
Hi,

I would like to know if dynamic generation of mail merge document using custom button(On-Click Javascript) is possible in salesforce.

Requirement - I am using Extended Mail Mergeand have 4 Mail Merge templates, based on one field value selected in the opportunity record, select the template and generate the document accordingly. Is this possible?
I found that XMM runs on Server side instead of Client side would this cause any issue?

Thanks
Kumar
  • February 26, 2016
  • Like
  • 0
Hi,

My requirement is to create a mail merge document from the opportunity record. In the template document, I have one Checkbox which corresponds to a checkbox field on the opportunity record. Whenever user checks this checkbox in salesforce, I want the checkbox in mail merge doc to be checked. I tried using the IF condition and {FORMCHECKBOX} merge fields in word doc. It is not working. Please help.

Thanks
Siva
  • February 18, 2016
  • Like
  • 0
Hi,

Requirement - 

Custom object A has three fields Field1(picklist),Field2(Created date),Field3(Final date)
Field1 has picklist values pickX,pickY,pickZ
I have another Custom object B with each field label matching with custom object's Field1 picklist values i.e. pickX,pickY,pickZ fields with values 10,20,30. There will be only 1 record in object B which is maintained by the end-user.
Everytime user selects Field1 picklist value then the end date should be calculated based on the value in the corresponding field in object B
i.e. if user selects Field1 pick list value pickY, then the Final Date should be calculated as Final date = Created date + 20.

There is no relation between objects A & B.
How can we achieve this using Dynamic Apex i.e. Schema.getdescribe()?

Thanks
Kumar
 
  • December 04, 2015
  • Like
  • 0
Hi,

I have a problem with the javascript. I am trying to populate the end date based on the selected start date through JavaScript/actionFunction. But for some reason the end date is not populated after selecting the start date. It is displaying blank value in the end date field. I can see the end date value in debug log. Please see the below code and let me know where the issue is.

----- VFP -----
<apex:page standardController="Contact" id="thePage" extensions="Contactext">
    <apex:form id="theForm">
    <apex:actionFunction name="jsSetEndDate" action="{!actionFunctionM}" immediate="true" reRender="endtid">  
        <apex:param assignTo="{!Startdate }" value="Startdate" id="Startdate" name="enddate"/>  
    </apex:actionFunction> 
    <script>
        var startdateid;
        var enddateid;
        //var edate = '{!enddate}';
        function onchangestartdate(datevalue)
        {
             //Assign value to the no of employee field  
                    if(document.getElementById(startdateid) != null)
                    jsSetEndDate(datevalue)
                    var edate = '{!enddate}';                    
                    alert(edate);
                    //document.getElementById(enddateid).value = '{!enddate}'; 
                    document.getElementById(enddateid).value = edate; 
        }
    </script>
        <apex:pageBlock id="thePageBlk">
                <apex:repeat value="{!$ObjectType.Contact.FieldSets.Contact_Fields}" var="f" id="theRepeat">
                    <Br/><apex:inputField value="{!contact[f]}" rendered="{!IF(OR(CONTAINS(LOWER(f.label), 'start date') , CONTAINS(LOWER(f.label), 'end date')), false , true )}"/>                
                    <Br/><apex:inputField value="{!contact[f]}" onchange="onchangestartdate(this.value);" rendered="{!IF(CONTAINS(LOWER(f.label), 'start date') , true , false)}" id="stdtid"/>
                    <Br/><apex:inputField value="{!contact[f]}" rendered="{!IF(CONTAINS(LOWER(f.label), 'end date') , true , false)}" id="endtid"/>
                    <script>  
               /* 
                   Set the id for numberofemployeesID field can be used in java script 
               */
               if({!CONTAINS(LOWER(f.label), 'start date')})  
               {  
                  startdateid = '{!$Component.theRepeat}:stdtid';  
               }    
               if({!CONTAINS(LOWER(f.label), 'end date')})  
               {  
                  enddateid = '{!$Component.theRepeat}:endtid';  
               }  
                    </script>
                </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

------ Controller ----

public with sharing class Contactext {
    public Date Startdate {get;set;}
    public Date enddate {get;set;}

    public Contactext(ApexPages.StandardController controller) {
            enddate = System.today();
    }
    public void actionFunctionM()  
    {  
       enddate = Startdate + 10;
       System.debug('End date ' + enddate );
    }

}

Thanks
Kumar
  • December 03, 2015
  • Like
  • 0
Hi,

I have an Opportunity after update trigger. The opportunity should contain only the equipments listed in the Equipment list(Custom setting). If any Opp equipment is not present in Custom setting list then I wanted that to be removed from a Map. I am creating a map of Equipment name(Key) and Opp(Value) but that is creating a problem as we have common equipments between opps.

Trigger code - 

Equipmap = PNC_Equipment_List__c.getAll(); //Custom setting data into a map

for(Equipment__c e : [SELECT Id,Name,Opportunity__c FROM Equipment__c WHERE Opportunity__c in :OppOwnerIdMap.keySet()]){
      EqpOppMap.put(e.Name,e.Opportunity__c);
  }

for(String str : EqpOppMap.keySet()){
         if(Equipmap.containsKey(str)){
             System.debug('Equip Present ' + str + '-' + EqpOppMap.get(str));
         }
         else{
             System.debug('**** Equip remove Opp Id :' + EqpOppMap.get(str));
             OppOwnerIdMap.remove(EqpOppMap.get(str));
         }
     }

Problem with the code -

If multiple Opps have same equipment, since am storing it in a map with key as Equipment name only few opporunities are getting stored in that map. This is causing some problem as am misssing out on some opportunities.

Ex - I have 4 opps and 3 opps have same equipments(EqupA,EqupB) which are not present in the Equipment list(Custom setting). so I want them to be removed from further processing. so I need a map/list of Opps after removal.
In this case I want only OppC in the final map/list as this EqupC is present in Equipment list(Custom setting)

Before Filter - (How can I handle this in code)

EqupA,OppA
EqupB,OppA
EqupA,OppB
EqupB,OppB
EqupC,OppC
EqupA,OppD
EqupB,OppD

After Filter -

Equpc,Oppc


Please help!

Thanks
Kumar

 
  • October 13, 2015
  • Like
  • 0

Hi,

I would like to create a custom web service in my Salesforce organization to share some data when external application sends a request. The external application sends the request with some identifier. I need to respond with the related status.

Identifier can have 1 status(one-to-one mapping) Identifier can have multiple children (one-to-many mapping) How can I send this back to external application?

In 2nd case, I need to send both child I'd and statuses (map).

Thanks
Kumar
  • August 24, 2015
  • Like
  • 0
Hi,

I wanted to execute below code in 'Execute Anonymous' window in production every 5 minutes. I don't want to create Batch/Schedule classes at this time.

List<Queue_Member__c> qlistupd = new List<Queue_Member__c>();
for(Queue_Member__c q : [SELECT Id, Name, Last_Assigned_Case__c, Number_of_Open_Cases__c, Login_Status__c, Agent__c, Threshold__c, Chase_owner__c FROM Queue_Member__c]){
    Integer count = [SELECT count() from case where status in ('Open', 'Action Required') and Ownerid = :q.Agent__c and RecordType.Name = 'TASQ OneSource'];
      q.Number_of_Open_Cases__c = count;
      qlistupd.add(q);
}

if(!qlistupd.isEmpty()){
    try{
        update qlistupd;
    }
    Catch(Exception e){
        System.debug('Exception occured' + e);
    }
}


Thanks
Kumar
  • July 01, 2015
  • Like
  • 0
Hi,

The below code snippet is in Opportunity afterUpdate trigger. I am trying to update the accounts of those affected opportunities and after getting DMLException, the code enters catch block and I get 'System.FinalException: SObject row does not allow errors' at row  a.Id.addError(de.getMessage());

Please let me know what is wrong with the line a.Id.addError(de.getMessage());

 if(acctLst.size()>0){
           try{
            update acctLst;
             }
             catch(Exception de){
              for (Account a : acctLst) {
               a.Id.addError(de.getMessage());
                }
             }
        } 
  • June 29, 2015
  • Like
  • 0
Hi,

I wanted to display a custom field as Read-Only on the Edit page ONLY of a custom object. This field should be hidden on the detail page. I tried wrapping the field in a section and display the section in Edit Page only(Page layout editor). That didn't work. I don't want to create a custom visual force page for the EDIT Page. Please suggest.

Thanks
Kumar
  • June 22, 2015
  • Like
  • 0
Hi,

I am getting a null pointer exception in controller class for the below line.I assume opportunityQuoteRecordType is having a null value in some scenario. There are 4 options on VF page to select opportunityQuoteRecordType. opportunityQuoteRecordType is defaulted to some value in constructor and its selected in VF page when loads.

How to fix this issue?

queryString += ' and QQ_Plan_Pricing_Mthd_dim__c = \'' + string.escapeSingleQuotes(opportunityQuoteRecordType) + '\'';

Thanks
Kumar
 
  • May 07, 2015
  • Like
  • 0
My requirement is there will be 2 pageblocksectionitems(new) will be added to the vf page and those will be hidden by default when the page loads initially.These changes will be moved to Production as-is(hidden). After sometime in the backend they will flip the FEE field value(not displayed on the page) to 5.99 then these 2 pageblocksectionitems should be displayed as per the below conditions.

I am setting the cardreaderfeeIndicator value to 'On' in my controller when the FEE is changed from FREE to 5.99.

I have added below condition rendered to the 2 pageblocksectionitems  and now they are getting displayed when the page loads initially(when I change cardreaderfeeIndicator == 'On' for testing). I don't want that 2 happen. I want to display the 2 pageblocksectionitems as per the below conditons.

To display the 1st pageblocksectionitem the condition is cardreaderfeeIndicator == 'On' && Picklist A(cardreader) value is 'Yes'

To display the 1st pageblocksectionitem the condition is cardreaderfeeIndicator == 'On' && Picklist A(cardreader) value is 'No'

But Rendered is not working on the 2 pageblocksectionitems. Please let me know what's wrong with it.

<apex:pageBlockSectionItem id="cardreader" >
                    <apex:outputPanel >
                        <apex:outputLabel style="color:red">*</apex:outputLabel>
                        <apex:outputLabel value="Was card reader provided"/><br/> <apex:outputLabel value="to applicant:" />
                    </apex:outputPanel>                    
                    <apex:inputField value="{!NewSRSMPODLead.Card_Reader_at_Branch__c}" id="inputcardreader" onchange="checkYes('select');" style="width:250px" onkeypress="handleKeyPressSearch(event);" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem id="shipoption" >
                    <apex:outputPanel id="shipoptionSpan" >
                    <apex:outputLabel style="color:red">*</apex:outputLabel>
                    <apex:outputLabel value="Card reader shipping options:"/>
                    </apex:outputPanel>
                    <apex:outputPanel id="shipspann" >
                        <apex:selectList value="{!NewSRSMPODLead.Shipping_Options__c}" id="ShippingOptionsId" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);"  >
                            <apex:selectOptions Value="{!ShippingOptions}"/>
                        </apex:selectList>
                                            
                    </apex:outputPanel>
                    <!-- 
                    <apex:outputPanel >
                        <apex:inputField id="ShippingOptionsId" value="{!NewSRSMPODLead.Shipping_Options__c}" style="width:250px" />
                        <script>document.getElementById("{!$Component.ShippingOptionsId}").disabled= true;</script>
                    </apex:outputPanel>
                     -->                    
                </apex:pageBlockSectionItem>                
                <apex:pageBlockSectionItem id="emvQn" rendered="{!IF((cardreaderfeeIndicator == 'On' && NewSRSMPODLead.Card_Reader_at_Branch__c == 'Yes'),true,false)}">
                    <apex:outputPanel id="emvQSpan">
                        <apex:outputLabel style="color:red">*</apex:outputLabel>
                        <apex:outputLabel value="If you have a non-EMV"/><br/> 
                        <apex:outputLabel value="compliant card reader, would" /><br/>
                         <apex:outputLabel value="you like to purchase an"/><br/>
                         <apex:outputLabel value="EMV-compliant card reader:" />
                    </apex:outputPanel>
                    <apex:outputPanel id="emvQOSpan">
                        <apex:selectList Value="{!ReaderOption}" id="ReaderOptionsId" onchange="Readerdef('select');" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="Yes" itemLabel="Yes"/>                            
                            <apex:selectOption itemValue="No" itemLabel="No" />
                        </apex:selectList>                        
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>                
               <apex:pageBlockSectionItem id="emvOpn" rendered="{!IF((cardreaderfeeIndicator == 'On' && NewSRSMPODLead.Card_Reader_at_Branch__c == 'No'),true,false)}">                
                    <apex:outputPanel id="emvOpnSpan">
                      <apex:outputLabel style="color:red">*</apex:outputLabel>                        
                      <apex:outputLabel value="Reader Type:"/>
                    </apex:outputPanel>
                    <apex:outputPanel id="emvReadSpan">
                      <apex:selectList Value="{!NewSRSMPODLead.Reader_Type__c}" id="ReaderTypeId" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="EMV Card Reader" itemLabel="EMV"/>
                            <apex:selectOption itemValue="MSR Card Reader" itemLabel="MSR"/>                            
                            <apex:selectOption itemValue="Not Applicable" itemLabel="No thanks"/>
                      </apex:selectList>                                                
                   </apex:outputPanel>
                </apex:pageBlockSectionItem>

Javascript function on change of Picklist A
function checkYes(type){          
            var shipping = '{!shippingindicator}';
            var cardInd = '{!cardreaderfeeIndicator}';
            if(type == 'init' && shipping == 'false'){
                document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipoptionSpan}").style.display ="none";
                document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipspann}").style.display ="none";
            }
            else{               
                if(type == 'init' && shipping == 'true'){
                    document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipoptionSpan}").style.display ="block";
                    document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipspann}").style.display ="block";                                                            
                }
                else{
                    var chk = document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.cardreader.inputcardreader}");                    
                    if(type != 'init' && chk.value == 'No' && shipping == 'true'){
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipoptionSpan}").style.display ="block";
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipspann}").style.display ="block";
                    }
                    else if(type != 'init' && chk.value == '' && shipping == 'true'){
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipoptionSpan}").style.display ="block";
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipspann}").style.display ="block";                                                                  
                    }
                    else{
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipoptionSpan}").style.display ="none";
                        document.getElementById("{!$Component.thePage.theform.thepageblck.thepageblkSec.shipoption.shipspann}").style.display ="none";
                }
            }                                                
        }
    }

Please ping/email me @sivais040@gmail.com.

Thanks
Kumar

 
  • March 30, 2015
  • Like
  • 0

My requirement is the below two pageblocksectionitems should be hidden by default when the page loads initially and in the backend they will flip the FEE field value(not displayed on the page) to 5.99 then these 2 pageblocksectionitems should be displayed conditionally(which I already handled).

I have added 2 pageblocksectionitems in a visualforce page. But I want to display those based on a field value. How can I accomplish this?

Code snippet -
<apex:pageBlockSectionItem id="emvQn">
                    <apex:outputPanel id="emvQSpan">
                        <apex:outputLabel style="color:red">*</apex:outputLabel>
                        <apex:outputLabel value="If you have a non-EMV"/><br/> 
                        <apex:outputLabel value="compliant card reader, would" /><br/>
                         <apex:outputLabel value="you like to purchase an"/><br/>
                         <apex:outputLabel value="EMV-compliant card reader:" />
                    </apex:outputPanel>
                    <apex:outputPanel id="emvQOSpan">
                        <apex:selectList Value="{!ReaderOption}" id="ReaderOptionsId" onchange="Readerdef('select');" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="Yes" itemLabel="Yes"/>                            
                            <apex:selectOption itemValue="No" itemLabel="No" />
                        </apex:selectList>                        
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
                
               <apex:pageBlockSectionItem id="emvOpn">                
                    <apex:outputPanel id="emvOpnSpan">
                      <apex:outputLabel style="color:red">*</apex:outputLabel>                        
                      <apex:outputLabel value="Reader Type:"/>
                    </apex:outputPanel>
                    <apex:outputPanel id="emvReadSpan">
                      <apex:selectList Value="{!NewSRSMPODLead.Reader_Type__c}" id="ReaderTypeId" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="EMV Card Reader" itemLabel="EMV"/>
                            <apex:selectOption itemValue="MSR Card Reader" itemLabel="MSR"/>                            
                            <apex:selectOption itemValue="Not Applicable" itemLabel="No thanks"/>
                      </apex:selectList>                                                
                   </apex:outputPanel>
                </apex:pageBlockSectionItem>

Thanks
Kumar
  • March 29, 2015
  • Like
  • 0
Hi,

I have added 2 pageblocksectionitems in a visualforce page. But I want to display those based on a field value. How can I accomplish this?

Code snippet -
<apex:pageBlockSectionItem id="emvQn">
                    <apex:outputPanel id="emvQSpan">
                        <apex:outputLabel style="color:red">*</apex:outputLabel>
                        <apex:outputLabel value="If you have a non-EMV"/><br/> 
                        <apex:outputLabel value="compliant card reader, would" /><br/>
                         <apex:outputLabel value="you like to purchase an"/><br/>
                         <apex:outputLabel value="EMV-compliant card reader:" />
                    </apex:outputPanel>
                    <apex:outputPanel id="emvQOSpan">
                        <apex:selectList Value="{!ReaderOption}" id="ReaderOptionsId" onchange="Readerdef('select');" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="Yes" itemLabel="Yes"/>                            
                            <apex:selectOption itemValue="No" itemLabel="No" />
                        </apex:selectList>                        
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
                
               <apex:pageBlockSectionItem id="emvOpn">                
                    <apex:outputPanel id="emvOpnSpan">
                      <apex:outputLabel style="color:red">*</apex:outputLabel>                        
                      <apex:outputLabel value="Reader Type:"/>
                    </apex:outputPanel>
                    <apex:outputPanel id="emvReadSpan">
                      <apex:selectList Value="{!NewSRSMPODLead.Reader_Type__c}" id="ReaderTypeId" size="1" style="width:250px" onkeypress="handleKeyPressSearch(event);">
                            <apex:selectOption itemValue="None" itemLabel="--None--" />
                            <apex:selectOption itemValue="EMV Card Reader" itemLabel="EMV"/>
                            <apex:selectOption itemValue="MSR Card Reader" itemLabel="MSR"/>                            
                            <apex:selectOption itemValue="Not Applicable" itemLabel="No thanks"/>
                      </apex:selectList>                                                
                   </apex:outputPanel>
                </apex:pageBlockSectionItem>

Thanks
Kumar
  • March 27, 2015
  • Like
  • 0
Hi,

I have two picklist values as shown below

1st picklist 
<apex:selectOption itemValue="None" itemLabel="--None--" />
<apex:selectOption itemValue="No" itemLabel="No" />
<apex:selectOption itemValue="Yes" itemLabel="Yes"/>

2nd Picklist has values coming from 
None
A
B

Requirements  -

1) I see 'No' as the default value in the 1st picklist. I wanted None to be the default.

2) If 1st picklist value 'Yes' is selected then 2nd Picklist value B should be selected by default. How can we achieve this?

Thanks
Kumar

 
  • March 26, 2015
  • Like
  • 0
Hi,

I have a requirement wherein I have to rearrange four picklist values displayed in a vf page as given below .

Current display order  - 

Please Select one
3 Day Shipping
Ground shipping
Overnight shipping

Required display order -

Please Select one
Ground shipping
3 Day Shipping
Overnight shipping

Thanks
Kumar
  • March 10, 2015
  • Like
  • 0
Hi,

I am getting 'Method does not exist or incorrect signature' error while deploying the code. I have 2 different classes A & B. B has X method in it and A is calling X method.

Before in Prodcopy
X(List)
After
X(Map<>)

I have changed the method definition and updated the parameter variable declartion from list to map. I am trying to deploy both classes at once to Prodcopy. Prodcopy has got old method X with parameter as List. Is this creating a problem while deploy?

Please help.

Thanks
Kumar
  • January 27, 2015
  • Like
  • 0
Hi,

A Scheduled batch apex job has been deleted from my Prod org. Is there a way to identify how it got deleted and who deleted it?

Thanks
Kumar
  • November 26, 2014
  • Like
  • 0
Hi,

I have 3 Apex classes in Dev Sandbox and details are given below.

Code coverage after testing.
Case - 79% - 51/64
Lead - 66% - 101/152
Opp - 78% - 221/280

Code deployed to Prodcopy Sandbox along with test class and ran the test class.

Code coverage after running the test class. For some reason code coverage is showing some old data.
Case - 72% - 42/58
Lead - 84% - 131/155
Opp - 85% - 193/226

Code matches between Dev & Prodcopy Sandbox. I am not sure what's wrong with Prodcopy Sandbox. When I ran the test class on Friday evening 1 test method failed out of 21.(Assertion failure) and it didn't fail in Dev Sandbox.

Now whenever I ran the test class since Yesterday, 5 test methods are failing with 'Attempt to de-reference a null object' in Opp class at same line. Still all 21 test methods are passing in Dev Sandbox. 

Please help me.

Thanks
Kumar
  • November 09, 2014
  • Like
  • 1
Hi,

Requirement - 

Custom object A has three fields Field1(picklist),Field2(Created date),Field3(Final date)
Field1 has picklist values pickX,pickY,pickZ
I have another Custom object B with each field label matching with custom object's Field1 picklist values i.e. pickX,pickY,pickZ fields with values 10,20,30. There will be only 1 record in object B which is maintained by the end-user.
Everytime user selects Field1 picklist value then the end date should be calculated based on the value in the corresponding field in object B
i.e. if user selects Field1 pick list value pickY, then the Final Date should be calculated as Final date = Created date + 20.

There is no relation between objects A & B.
How can we achieve this using Dynamic Apex i.e. Schema.getdescribe()?

Thanks
Kumar
 
  • December 04, 2015
  • Like
  • 0
Hi

I'm pretty much new to salesforce. As my first task i had written a trigger but need help to write a test case or test class. Please any help on this?
 
trigger OpportunityWeightageRev on Opportunity (before update) {
    double prob_diff = 0;
    double Nrev = 0; //New revenue
    double Orev = 0; //Old revenue
    
    Opportunity OprLast; //Previous opportunity data
    for(Opportunity Opr : Trigger.new){
        OprLast = Trigger.oldMap.get(Opr.id); 
        if(OprLast.Probability != opr.Probability){
            if(prob_diff==0){
                prob_diff = math.abs(OprLast.Probability - opr.Probability);
            }
            if((opr.Total_Contract_Value__c==0) || (opr.Total_Contract_Value__c==null)) opr.Total_Contract_Value__c = 0;
            nrev = opr.Total_Contract_Value__c * (prob_diff/100);
            orev = OprLast.Weighted_Revenue__c;
            
            if(orev<>0){
                opr.mplan__c 		=  nrev / orev;

            }
        }            
    }
}

 
  • November 18, 2015
  • Like
  • 0
Hi,

I have an Opportunity after update trigger. The opportunity should contain only the equipments listed in the Equipment list(Custom setting). If any Opp equipment is not present in Custom setting list then I wanted that to be removed from a Map. I am creating a map of Equipment name(Key) and Opp(Value) but that is creating a problem as we have common equipments between opps.

Trigger code - 

Equipmap = PNC_Equipment_List__c.getAll(); //Custom setting data into a map

for(Equipment__c e : [SELECT Id,Name,Opportunity__c FROM Equipment__c WHERE Opportunity__c in :OppOwnerIdMap.keySet()]){
      EqpOppMap.put(e.Name,e.Opportunity__c);
  }

for(String str : EqpOppMap.keySet()){
         if(Equipmap.containsKey(str)){
             System.debug('Equip Present ' + str + '-' + EqpOppMap.get(str));
         }
         else{
             System.debug('**** Equip remove Opp Id :' + EqpOppMap.get(str));
             OppOwnerIdMap.remove(EqpOppMap.get(str));
         }
     }

Problem with the code -

If multiple Opps have same equipment, since am storing it in a map with key as Equipment name only few opporunities are getting stored in that map. This is causing some problem as am misssing out on some opportunities.

Ex - I have 4 opps and 3 opps have same equipments(EqupA,EqupB) which are not present in the Equipment list(Custom setting). so I want them to be removed from further processing. so I need a map/list of Opps after removal.
In this case I want only OppC in the final map/list as this EqupC is present in Equipment list(Custom setting)

Before Filter - (How can I handle this in code)

EqupA,OppA
EqupB,OppA
EqupA,OppB
EqupB,OppB
EqupC,OppC
EqupA,OppD
EqupB,OppD

After Filter -

Equpc,Oppc


Please help!

Thanks
Kumar

 
  • October 13, 2015
  • Like
  • 0

Hi,

I would like to create a custom web service in my Salesforce organization to share some data when external application sends a request. The external application sends the request with some identifier. I need to respond with the related status.

Identifier can have 1 status(one-to-one mapping) Identifier can have multiple children (one-to-many mapping) How can I send this back to external application?

In 2nd case, I need to send both child I'd and statuses (map).

Thanks
Kumar
  • August 24, 2015
  • Like
  • 0
Hi

I am getting the above error but can't seem to locate exactly what the issue is. A few other posts suggest that I need to remove the DML from within the For loops. I believe I have done this unless I am missing something.

Can the community assist me in this please?
 
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
//
//  Name:
//      CI_Contact
//
//  Purpose:
//      This will process changes that need to be made based on fields that may change when 
//      contacts are inserted, edited, deleted and undeleted
//  
//  Created by:
//      Andrew Telford
//
//  Date: 
//      2015-07-31
//
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------

trigger CI_Contact on Contact ( after insert, after update, after delete, after undelete) 
{

//  Let us prepare some common variables
//----------------------------------------------------------------------------------------------
    system.debug('Set the variables');

    // Common items
    STRING thisContactID;
    STRING thisContactOwnerID;
    STRING userID;
    STRING userProfileID;
    STRING errMsg = '';


//--    Let us get the details relating to this contact change
//----------------------------------------------------------------------------------------------
    system.debug('Contact[]');

//--    Set the details of the trigger to a variable for use through the trigger
//----------------------------------------------------------------------------------------------
    Contact[] strContact;

    if (Trigger.isDelete) 
    {   strContact = Trigger.old;   }
    else
    {   strContact = Trigger.new;   }

    Set<ID> contactID = new Set<ID>();
	Set<ID> ownerIds = new Set<ID>();
	Set<ID> oldOwnerIds = new Set<ID>();
    for(Contact objCont: strContact)
    {
        ownerIds.add(objCont.ownerId);
        if ( !TRIGGER.isInsert && !TRIGGER.isunDelete )
        {	
            oldOwnerIds.add(TRIGGER.oldMap.get(objCont.Id).ownerId);
        }
    }


    LIST<Contact> contsToUpdate = [SELECT Id, OwnerId, Approved_Owner_Change__c, Approved_Owner_Name__c FROM Contact WHERE Id IN :strContact AND Approved_Owner_Change__c = TRUE];
    LIST<User> thisOwner = [Select Id FROM User WHERE ID IN :ownerIds];
	LIST<Contact> ownerMMCount = [SELECT Id FROM Contact WHERE ownerId IN :ownerIds AND CCC_Adviser__c = TRUE];
    LIST<User> oldOwner = [Select Id FROM User WHERE ID IN :oldOwnerIds];
    LIST<Contact> oldOwnerMMCount = [SELECT Id FROM Contact WHERE ownerId IN :oldOwnerIds AND CCC_Adviser__c = TRUE];

    FOR(Contact objCont: strContact)
    {
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
//
//  Owner Change Approved
//
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------

        system.debug('Set the variable values');

    //--    Define any variables required
    //----------------------------------------------------------------------------------------------
        BOOLEAN approvedOwnerChange;
        STRING newContactID = '';

    //--    Assign Values to Variables
    //----------------------------------------------------------------------------------------------
        contactID.add(objCont.Id);
        thisContactID = objCont.Id;
        thisContactOwnerID = objCont.OwnerId;
        userID = userinfo.getUserId();
        userProfileID = userinfo.getProfileId();
        approvedOwnerChange = objCont.Approved_Owner_Change__c;

        system.debug('Determine if owner is to change');

    //--    Check for change forced by workflow
    //----------------------------------------------------------------------------------------------

		if ( !TRIGGER.isAfter && !TRIGGER.isDelete )
        {
            if( objCont.Approved_Owner_Change__c )
            {

    //--    Check to see if we are updating the owner
    //----------------------------------------------------------------------------------------------
                if( TRIGGER.isupdate && objCont.Approved_Owner_Change__c )
                {
					system.debug('Owner is to change');

    //--    Set the update list
    //----------------------------------------------------------------------------------------------
	                List<Contact> updateOwner = new List<Contact>();

                    FOR (Contact cont: contsToUpdate)
                    {
	                    Boolean alterOwner = FALSE;

                        IF ( cont.Approved_Owner_Change__c = TRUE )
                        {   alterOwner  = TRUE; }

                        if (alterOwner) 
                        {
                            cont.OwnerID = cont.Approved_Owner_Name__c;
                            cont.Approved_Owner_Change__c = FALSE;
                            newContactID = cont.Approved_Owner_Name__c;
                        }
                        updateOwner.add(cont);
                    }


    //--    Execute the update
    //----------------------------------------------------------------------------------------------
                    if (!updateOwner.isEmpty()) 
                    {
                        try{ update updateOwner; }
                        catch (Exception ex)
                        { System.debug('Could not update New Contact Owner [' + newContactID + '] cause: ' + ex.getCause() + 'APEX TRIGGER: CI_Trigger_Contact');}
                    }
                }
            }   //--    End Check for automated change after insert
        }
//
//  End Approve Owner Change
//
//--------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------
//
//  Magic Movers
//
//  This works in conjunction with:
//      Validations
//          Magic Mover Addition (03dc00000009014)
//          Magic Mover REmoval (03dc00000009080)
//
//      Workflow Field Update
//          New Contact (01Q20000000Es9Z)
//          Set Magic Mover to False (04Yc000000090G1)
//
//--------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------

    //--    Magic Movers 
        BOOLEAN magicMover;
        DECIMAL userMagicCount;

    //--    Select the Owner Information
        LIST<User> updateMM = new LIST<User>();
        system.debug( 'Size of thisUser: ' + thisOwner.size());

		FOR ( User mm1: thisOwner )
        {
            mm1.Magic_Movers_Count__c = ownerMMCount.size();
            updateMM.add(mm1);

        }   //--    For Current Owner Loop

    //--    Process the updates
    //------------------------------------------------------------------------------------------------------------------------------
        system.debug('size of: ' + updateMM.size());
        if (!updateMM.isEmpty()) 
        {
            try{ update updateMM; }
            catch (Exception ex)
            { objCont.addError(' Error Updating ' + ex.getCause()); System.debug('Could not update User [' + thisContactOwnerID + '] cause: ' + ex.getCause() + 'APEX TRIGGER: CI_Trigger_Contact'); }
        }

	//--	Check to see if the Owner has changed
	//-----------------------------------------------------------------------------------------------------------------------------
        LIST<User> updateOldMM = new LIST<User>();
        system.debug( 'Size of oldOwner: ' + oldOwner.size());

		FOR ( User mm2: oldOwner )
        {
            mm2.Magic_Movers_Count__c = oldOwnerMMCount.size();
            updateOldMM.add(mm2);

        }   //--    End For Old Owner Loop

	//--    Process the updates
    //------------------------------------------------------------------------------------------------------------------------------
        system.debug('size of: ' + updateOldMM.size());
        if (!updateOldMM.isEmpty()) 
        {
            try{ update updateOldMM; }
            catch (Exception ex)
            { objCont.addError(' Error Updating ' + ex.getCause()); System.debug('Could not update User [' + thisContactOwnerID + '] cause: ' + ex.getCause() + 'APEX TRIGGER: CI_Trigger_Contact'); }
        }


//
//  End Magic Movers
//
//--------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------

    }
//
//  End Contact Loop
//
//--------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------
}

 
Hello Everyone,

I have found bits of code here and there and manipulated to be what I needed. It seems to work for all of the scenarios that I have tried, but I wanted to know if the way that I have written it is inefficient or not as efficient as it could be. Would anyone care to take a look at this code and tell me if they approve or if I should have done something different?

We have two picklist fields with many values on the object. We need the first field to filter down to just certain values in a visualforce page in a managed package, but you can't do that without a dependency. So, we created a second field with all of the same values to allow us to display the second one on the visualforce page with the filtered list based on the one that is selected in the original field. We didn't want to create multiple WFRs for each value so we needed to create a trigger. The trigger should only update the original field when a change has been to the secondary field.

Here is the code for the trigger:

trigger updateOrderStatusWorkOrder on SVMXC_Service_Order__c (before insert, before update) {  
    Map<String, String> myPickListMap = new Map<String, String> {
        'Open'=>'Open', 'In Progress'=>'In Progress', 'Completed'=>'Completed', 'Closed'=>'Closed', 'Cancelled'=>'Cancelled'
    };
    
    for (SVMXC_Service_Order__c wo : Trigger.new)  {
      if(trigger.isUpdate) {
        if(wo.Order_Status__c != trigger.oldMap.get(wo.Id).Order_Status__c &&
            wo.SVMXC_Order_Status__c != wo.Order_Status__c &&
            wo.Order_Status__c != NULL) {
                wo.SVMXC_Order_Status__c = myPickListMap.get(wo.Order_Status__c);        
        }
      }
      if(!trigger.isUpdate) {
          if(wo.SVMXC_Order_Status__c != wo.Order_Status__c &&
              wo.Order_Status__c != NULL){
                wo.SVMXC_Order_Status__c = myPickListMap.get(wo.Order_Status__c);  
          }
      }
    }     
}
Hi,

I wanted to display a custom field as Read-Only on the Edit page ONLY of a custom object. This field should be hidden on the detail page. I tried wrapping the field in a section and display the section in Edit Page only(Page layout editor). That didn't work. I don't want to create a custom visual force page for the EDIT Page. Please suggest.

Thanks
Kumar
  • June 22, 2015
  • Like
  • 0

I am fresher salesforce developer, I am searching jobs in india.

bur all software companies required experence  sfdc developer.then  

what is future enhancement of fresher salesforce developer?.

Hello all,

I am hoping to create a workflow rule that will assign tasks for various things. When these tasks are marked as complete, I'd like to trigger an update to a custom object that checks a checkbox to show it's been completed as well as update the date. I understand this cross object update is not possible with workflow.

Could this be possible with either process builder/flows/triggers or some combination? I am a point and click administrator at this point so I don't have any coding knowledge. Any help would be appreciated!

Thank you,

Blair
Hello,

I have few coupoun code available for the person who is willing to give certifications. Avail 25% instant discount on any salesforce certification. You can contact me here:
vickyr923@gmail.com

Thanks

global class BatchService implements Database.Batchable<SObject>, Database.Stateful{
    global String query;
    
    global database.querylocator start(Database.BatchableContext BC){ 
                query = 'select id,Accountid,RecordtypeId,Service_Type__c,Total_Amount__c,Initial_Amount__c  from Opportunity';
       return Database.getQueryLocator(query); 
    }
    global void execute(Database.BatchableContext BC, List<Opportunity> Opplist){  
    
       string str = null;
Set<Id> accountids = new Set<Id>();
Map<Id,String> mapacctname = new Map<id,String>();
Map<Id,String> mpstype = new Map<id,String>();
             for(opportunity opp:Opplist)
             {
                 mpstype.put(opp.id,opp.Service_Type__c);
             }

 for(opportunity opp1:Opplist)
{
    
if(opp1!=null)
{
if(opp1.accountId != null)
{
accountids.add(oppty.accountid);
}
List<Account> accounts = [Select id,name from Account where id in:accountids]; 
for(Account acc : accounts)
{
mapacctname.put(acc.id,acc.name);
}
RecordType r=[select id,name from RecordType Where id =:opp1.recordTypeId];
str = mapacctname.get(opp1.AccountId)+' '+mpstype.get(opp1.id)+' '+r.name;
list<Service__c> slist=[SELECT id,name,Accountname__c,Service_A1_Total_Amount__c,Service_A2_Total_Amount__c,Service_A3_Total_Amount__c,Service_A4_Total_Amount__c,Service_Type_Amount__c,Initial_A1_Amount__c,Initial_A2_Amount__c,Initial_A3_Amount__c,Initial_A4_Amount__c,Service_Type_Amount__c,Initial_Type_Amount__c,Service_Type__c from Service__c where name =:str];
   System.debug('before checking the slist  records');
    if(slist.size()==0)
    {
Service__c s=new Service__c();
s.name = mapacctname.get(opp1.AccountId)+' '+mpstype.get(opp1.id)+' '+r.name;
s.Accountname__c = opp1.AccountId;
s.Record_Type__c = r.name;
s.Service_Type__c = opp1.Service_Type__c;
        
if(opp1.Service_Type__c == 'A1')
{
s.Service_A1_Total_Amount__c = opp1.Total_Amount__c;
s.Initial_A1_Amount__c  = opp1.Initial_Amount__c; 
s.Service_Type_Amount__c = opp1.Total_Amount__c; 
s.Initial_Type_Amount__c = opp1.Initial_Amount__c;    
}
else if(opp1.Service_Type__c == 'A2')
{
s.Service_A2_Total_Amount__c = opp1.Total_Amount__c;
s.Initial_A2_Amount__c  = opp1.Initial_Amount__c; 
s.Service_Type_Amount__c = opp1.Total_Amount__c; 
s.Initial_Type_Amount__c = opp1.Initial_Amount__c;    
}
else if(opp1.Service_Type__c == 'A3')
{
s.Service_A3_Total_Amount__c = opp1.Total_Amount__c;
s.Initial_A3_Amount__c  = opp1.Initial_Amount__c; 
s.Service_Type_Amount__c = opp1.Total_Amount__c; 
s.Initial_Type_Amount__c = opp1.Initial_Amount__c;    

else if(opp1.Service_Type__c == 'A4')
{
s.Service_A4_Total_Amount__c = opp1.Total_Amount__c;
s.Initial_A4_Amount__c  = opp1.Initial_Amount__c; 
s.Service_Type_Amount__c = opp1.Total_Amount__c; 
s.Initial_Type_Amount__c = opp1.Initial_Amount__c;    
}
insert s;
}
else
{
list<Service__c> sold=[SELECT id,name,Accountname__c,Service_A1_Total_Amount__c,Service_A2_Total_Amount__c,Service_A3_Total_Amount__c,Service_A4_Total_Amount__c,Service_Type_Amount__c,Initial_A1_Amount__c,Initial_A2_Amount__c,Initial_A3_Amount__c,Initial_A4_Amount__c,Service_Type_Amount__c,Initial_Type_Amount__c,Service_Type__c from Service__c where name =:str];
       for(Service__c s1:sold ) 
  {
   if(opp1.Service_Type__c == 'A1')
{
s1.Service_A1_Total_Amount__c = opp1.Total_Amount__c;
s1.Initial_A1_Amount__c  = opp1.Initial_Amount__c;   
}
else if(opp1.Service_Type__c == 'A2')
{
s1.Service_A2_Total_Amount__c = opp1.Total_Amount__c;
s1.Initial_A2_Amount__c  = opp1.Initial_Amount__c;   
}
else if(opp1.Service_Type__c == 'A3')
{
s1.Service_A3_Total_Amount__c = opp1.Total_Amount__c;
s1.Initial_A3_Amount__c  = opp1.Initial_Amount__c;   

else if(opp1.Service_Type__c == 'A4')
{
s1.Service_A4_Total_Amount__c = opp1.Total_Amount__c;
s1.Initial_A4_Amount__c  = opp1.Initial_Amount__c;   
}
      s1.Service_Type_Amount__c =  s1.Service_A1_Total_Amount__c+s1.Service_A2_Total_Amount__c+s1.Service_A3_Total_Amount__c+s1.Service_A4_Total_Amount__c;
      s1.Initial_Type_Amount__c = s1.Initial_A1_Amount__c+s1.Initial_A2_Amount__c+s1.Initial_A3_Amount__c+s1.Initial_A4_Amount__c;        
 update s1;      
  } 
   }
    
}    
}
}
    global void finish(Database.BatchableContext BC){
        
           AsyncApexJob a = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed,
      TotalJobItems, CreatedBy.Email
      FROM AsyncApexJob WHERE Id =
      :BC.getJobId()];
   // Send an email to the Apex job's submitter notifying of job completion.
   Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
   String[] toAddresses = new String[] {a.CreatedBy.Email};
   mail.setToAddresses(toAddresses);
   mail.setSubject('Service Batch Job' + a.Status);
   mail.setPlainTextBody
   ('The batch Apex job processed ' + a.TotalJobItems +
   ' batches with '+ a.NumberOfErrors + ' failures.');
   Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}
Hi,

Just wondering why debug logs are getting deleted auotmatically after it shows up in logs. Here is the situation,
We are trying to run some  unit tests ,we can see the log is recorded but in few seconds it just disappears (No one is deleting it). Is it a standard behavior? or storage issue?  Any help would be greatly appreciated
Hi I have a requirement where in we have 2 objects call one parent and one child. The child object are related to parent and have a lookup relation between the two. The child records are sequence by a field called Order having values 1,2,3,4,5.

So every parent will have 5 children record. 

My requirement is that when the status of child 1 is complete, the Status of child 2 should become pending, i.e. I want updates between 2 child records but I cannot involve parent record. 

If someone can provide a logic it would be great hep.
Hi All,

I'm a newbie to triggers but from everything I've read I need to use one to solve my dilemma. How do i go about writing a trigger that will copy a field from a task and paste that into the same field in a new task? I can's seem to find many examples of teh syntax to copy fields within an object then paste them into a new object.

Thanks
Hi, 

  In visual force page we are displaying picklist with Yes or No Option we need to make No as a default view on visual force page. Please suggest how to make the change on this code 
 
<apex:outputLabel value=" Renewal Opportunity" for="RenOpp"/> 
          <apex:selectList value="{!RenewalOpportunity}" multiselect="false" size="1">
             <apex:selectOptions value="{!RenewalOpp}" />
          </apex:selectList>

Thanks

Sudhir