Posts

Showing posts from January 18, 2017

Show All custom and standard Object and respective field on VF Page

Image
Requirement: Provide a option on vf page that user can select any custom or standard object and create slelected SOQL query and get records according to selected fields  Solution:  Controller Class : public class clsCustStandObj  {     public PageReference checkAll1() {         return null;     }     public PageReference checkAll2() {         return null;     }     public string SelectedValue{get;set;}     public string SelectedObject{get;set;}     public List<SelectOption> lstofObj{get;set;}     public List<SelectOption> lstofAllselectedObj{get;set;}     public List<string> lstofAllfieldAndName{get;set;}     public List<WrapperClass> lstofStandardField{get;set;}     public List<WrapperClass> lstofCustomField{get;set;}     public List<string> lstofselectedfield{get;set;}     public string allselfield{get;set;}     public List<SObject> lstgetresult{get;set;}     public List<String> lstgetresult1{get;set;}    

Populate Objects in Drop down and on Selection redirect on standard creation page

Image
Requirement : Show a drop down on which there are standard and custom object will be appear when select any object it should redirect to standard new creation page Class Code: public class SobjectListcls  {      set<string> salesforceObjectSet = new set<string>();     Map<Id,List<ObjectPermissions>> permissionsetIdAndlstObjectPermissions = new Map<Id,List<ObjectPermissions>>();         public string strSobjectName{get;set;}     public SobjectListcls()     {       onlyReadPerrmission();     }     public void onlyReadPerrmission()     {         String userid = UserInfo.getUserId();         User thisUser = [select id, profile.Name from User where id=:userid];              permissionset perset = [select id from permissionset where PermissionSet.Profile.id =:thisUser.profileId];         PermissionSetAssignment[] lstPermissionSetAssignment =[SELECT AssigneeId,PermissionSetId FROM PermissionSetAssignment where AssigneeId =:UserInfo.getU

Added Multiple Row Dynamically on VF Page

Image
Requirement : Added Multiple row based on provided a numeric value in text box  Solution: Controller Class: public class multiRowAddedDynamicallyController {    public integer rowsnum { get; set; }   public List<Account> lstofaccount {get; set;}    public multiRowAddedDynamicallyController()   {      lstofaccount = new List<Account>();       lstofaccount.add(new Account());       }    public void addRows() {     for(integer i=0;i<rowsnum  ;i++)         {           lstofaccount.add(new Account());             }               }   public PageReference saveClose()   {   insert lstofaccount;      PageReference pgrefernce = new PageReference('https://ap1.salesforce.com/001/o');      pgrefernce .setRedirect(true);      return pgrefernce ;   } } VF Page: <apex:page controller="multiRowAddedDynamicallyController" sidebar="false">  <apex:form > <apex:sectionHeader title="" subtitle="Acc