• Sachin Sharma 3886
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 9
    Replies
Hi Expertz,

I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.

Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.

I don't have any clues for this that how to even start as i a newbie, Kinldy assists.

Thanks
Sachin Sharma
I have created a ExceptionLog object. When ever the new exception caught, i like to create a new record in my ExceptionLog Object.  But it is showing a exception like Limit exception:DML  Not allowed here. Can you please suggest how to resolve it? Is it possible to create a new record from the catch block? Please suggest me way to achieve this issue.
Data Import Wizard—this tool, accessible through the Setup menu, lets you import data in common standard objects, such as contacts, leads, accounts, opportunities, as well as data in custom objects. It can import up to 50,000 records at a time. It provides a simple interface to specify the configuration parameters, data sources, and the field mappings that map the field names in your import file with the field names in Salesforce.


can we import opportunities using data import wizard? as i cant see any option in data import wizard... but it is clearly mentioned in trailheads of admin 
I have custom page, and when i try to save it my page does not save any information. I used different type of codes for saving. Most of them does not work and some of them break my page. Is there anything wrong with my code that i could not find? ( My main problem is it should save information and return to the same page with values) Any idea? Thanks
 
public class test1 {

    public Product_Brief__c pb {get;set;}
    public User u {get;set;}

    private ApexPages.StandardController controller {get;set;}
    public boolean bUpdate {get;set;}
    public string loggedinUserId = UserInfo.getUserId();
    public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4'];

    public String ctId{
        get {
                ctId = u2.ContactId;
                return ctId;
            }
        set;
    }

    Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId];
    public string getacct(){
        Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId];  
        return acct.Name;
        return null;
        }

    Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1];

   /* public PageReference save() {
        controller.save();{
        pageReference pg = new pageReference('/apex/pitu3');
        pg.setRedirect(true);
        pg .getParameters().put('id',controller.getId());
        return pg;
        }
        return null;
    } */

    /* public PageReference save() {
       controller.save(); 
       return null;
    }  */


   /* public PageReference save() {
    if(controller.save() != null) { 
    PageReference ref = Page.sumpage3; 
    ref.setRedirect(true); 
    return ref; 
    }
     return null;
    } */


    public PageReference save() {
        if(controller.save() != null) {
        PageReference congratsPage = Page.pitu3;
        congratsPage.setRedirect(true);
        congratsPage.getParameters().put('id',controller.getId());
        return congratsPage;
        }return null;
    }

    public test1(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference page1(){
    return Page.pitu1;
    }

    public PageReference page2(){
    return Page.pitu2;
    }

    public PageReference page3(){
    return Page.pitu3;
    }

    public PageReference page4(){  
    return Page.pitu4;
    }

    public PageReference page5(){
    return Page.pitu5;
    }

}

 
When I scroll the window in IE it shows me the unspecified error at line 1 .Works fine in other browsers.
Kindly assist.
Below is the VF page:
 Refer only google map integration code, I have not copied all the VF page 
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>  
  <apex:includeScript value="{!URLFOR($Resource.myStyleSheet, 'jquery-ui-1.11.4.custom.min.js')}"/>  
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>  
<script type="text/javascript"  >
       $j = jquery.noConflict();
        $j(document).ready(function(){
         });-->
         <script>
        function submitListener(e){
            var keynum = 0;
            if (window.event){
                keynum = window.event.keyCode;
            }
            else if (e.which){
                keynum = e.which;
            }           
            // Here we check whether the Enter button was pressed
            if (keynum == 13){
                onFormSubmit();
                return false;
            }else
            {
            return true;
            }            
        }       
</script>
<style>
#slider-range-min {
            width: 120px;
            background: black;
            margin-bottom: 8px;     
 }
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
$j = jQuery.noConflict();
$j(document).ready(function(){
 });
</script>
<html>
<body>
<div id="googleMap" style="width:1300px;height:380px;border:1;" align="centre"></div>
</body>
</html> 
<apex:actionFunction name="initialize" reRender="pbid">
<!--<apex:param assignTo="{!accObj.Location__latitude__s}" value="lat"/>
<apex:param assignTo="{!accObj.Location__longitude__s}" value="long"/>-->
</apex:actionFunction>
<apex:pageBlock id="pbid" >
<script src="https://maps.googleapis.com/maps/api/js"/>
<script>
var latitude="{!Acc.Location__Latitude__s}";
var longitude="{!Acc.Location__Longitude__s}";
function initialize(lat,long) {
var sizeoflist="{!size}" ;
google.maps.event.clearListeners(window, 'resize');
var mapProp = {
    center:new google.maps.LatLng(lat,long),
    zoom:10,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
  var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
  icon = "http://maps.google.com/mapfiles/ms/icons/blue.png";
  var marker = new google.maps.Marker({
  map:map,
  position:new google.maps.LatLng(latitude,longitude),
  icon: new google.maps.MarkerImage(icon),
  title:"{!acc.Name},{!Acc.Location__Latitude__s},{!Acc.Location__Longitude__s}"
  });
  <apex:repeat value="{!SearchCourseWrapperList}" var="temp">
  <apex:outputText >
  var marker1 = new google.maps.Marker({
  map:map,
  position:new google.maps.LatLng("{!temp.JobVacancy.InstanceLocation__Latitude__s}","{!temp.JobVacancy.InstanceLocation__Longitude__s}"),
  title:"{!temp.JobVacancy.Name},{!temp.JobVacancy.Course__r.CourseName__c}"
  });
  </apex:outputText>
  </apex:repeat>
 }
  google.maps.event.trigger(map, "resize"); 
google.maps.event.addDomListener(window, 'load', initialize(latitude,longitude));
</script>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi,

I am working on some test class and got stuck at some place, need help.

My Controller class is

**************************************
public class APMP_cloneAgileProcessController {   
    public Agile_Process__c objAgile_Process{get;set;}
    public string AgileProcessId{get;set;}
    public list<Stage__c> lstAPMPStages{get;set;}    
    public APMP_cloneAgileProcessController(){
    
        AgileProcessId=ApexPages.currentPage().getParameters().get('id');
        objAgile_Process=[Select name, Process_Description__c, Active__c  from Agile_Process__c where id =:AgileProcessId];
        lstAPMPStages=[select id, name, Stage_Name__c from  Stage__c where  Agile_Process__c =:AgileProcessId];
    }    
     public PageReference Cancel() {
        return (new ApexPages.StandardController(objAgile_Process)).view();
    }
    public PageReference Save() {
        Agile_Process__c objnewAgileProc=new Agile_Process__c();    
       try{
        objnewAgileProc.Active__c= objAgile_Process.Active__c;
        objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
        objnewAgileProc.Name=objAgile_Process.Name;              
       insert objnewAgileProc;         
         list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();         
         for(Stage__c stg:lstAPMPStages){         
             Stage__c objstg=new Stage__c();
             objstg.Agile_Process__c=objnewAgileProc.id;
             objStg.Stage_Name__c=stg.Stage_Name__c;
             lstnewAPMPStgs.add(objStg);
         }         
         insert lstnewAPMPStgs;
         
       
       }catch(exception ex){
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
              ApexPages.addMessage(msg);
              return null;       
       }
        return (new ApexPages.StandardController(objnewAgileProc)).view();
    }
}
***************************************
And code for  my test class is 
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new  Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new  Apexpages.standardcontroller(AP);
Test.startTest();        
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.

Kindly help.