• CvrK
  • NEWBIE
  • 60 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 38
    Questions
  • 18
    Replies
Hi ,

How to Enable or Disable a commandbutton based on selecting a picklist value,
I have requirement to enable/disable a command button based on a picklist value then i have an Outputpanel(a fieldset inside) that has to be displayed when the button is clicked..the button has to be enabled only twice.

I am breaking my head since the three days, sample code will be very highly appreciated.
I am posting the question here after a lot of Online references, but i hav not find any online reference or code that is close to my requirement.


Thanks in Advance
Ck  
Hi Everyone,
Is there any way out there to provide Notes and Attachment option in VF Page(Web form),so that when users try to submit requests for the case object using web form they can enter the notes and upload related attachment along with the field values,which helps the support people to process their request,
Currently what i have in mind is, creating a Description(Text Area) field and making it availablle for then web form.just wondering if there is any better solution than my idea. Please provide me any sample code if possible.

Thanks
Cvrk 
Hi Everyone,
I have a requirement to display different fieldsets after rerender based on its respective picklist value selection by user in the field called Request Type.
After clicking save(saverequest custom method to save records) one record in Case Object and one in Custom Obj (Functional_Request__c) should be created along with an attached document(document should go into document object),now my records are saving in objects but i am unable to provide upload and download  functionality to my webforms.

Note: The upload option shoud be enabled/available to users only for the 1st Select option and download option for the 3rd option out of 3 options and currently there are unused variable and methods in the cotroller, i left it in as they are,thought it gets easier for anyone of you to help me.
Sample Web form

I have tried the steps from below links but no luck,i wonder it is because i have custom save method to save records and may not be close to my use case.
http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller
http://blog.jeffdouglas.com/2010/04/28/uploading-an-attachment-using-visualforce-and-a-custom-controller/


Help will be highly appreciated.

 
VF Page code:



                         <apex:actionRegion >
                            <apex:selectList label="Request Type" value="{!RequestValue}" size="1" multiselect="false">
                                    <apex:actionSupport event="onchange"  reRender="fieldSet"/>
                                    <apex:actionstatus startText="Applying Values.............">                   
                                    </apex:actionstatus>
                                     <apex:selectOption itemLabel="Provide Access Request" itemValue="Provide_Access_Request"></apex:selectOption
                                     <apex:selectOption itemLabel="Other" itemValue="Other"></apex:selectOption>
                                     <apex:selectOption itemLabel="Package Request" itemValue="Package_Request"></apex:selectOption> 
                                     </apex:selectList>
                          </apex:actionRegion>

          <apex:commandButton action="{!saveRequest}" value="Submit" styleClass="js-save-button button green submitButton" />
          <apex:commandButton action="{!Cancel}" value="Cancel" styleClass="js-save-button button green submitButton" />





Controller:

Public without sharing class  Provisional_Request_ctrl extends WSitesController
{

 

    /*Public Variables*/
    
    Public Functional_Request__c FormExtn {get;set;}
    Public List<Functional_Request__c> licaseformextn;// {get;set;}
    Public Map<string,Functional_Request__c> caseformmap;// {get;set;}
    Public Case Ocase; //{get;set;} 
    Public List<RecordType> OcaseRecordType;// {get;set;}
    public String recordType {get;set;}
    public String requesttype {get;set;}
    public String additionalcomments;//{get;set;} 
    public List<RecordType> ProvisionalRecordtypes {get; set;}
    public List<SelectOption> orecordtypes {get; set;}
    Public string iscentraloginisuue{get;set;}
    
    Functional_Request__c str;
    Public Document doc {get;set;}
    public List<String> docIdList = new List<string>();
  
    public boolean addAttachment{get; set;}
    public string setpopdisplay{get;set;}
    public List<Document> selectedDocumentList {get;set;}
    
    
    /* Error Message related variables */
    public boolean pageError {get; set;}
    public boolean showlist{get; set;}
    public boolean RenderFunction{get; set;}
    public boolean RenderFieldSetBlock{get; set;}
    public String pageErrorMessage {get; set;}
    public string formname{get;set;}
    Public Map<string,Id> caseformextrecordtypeMap{get;set;}
    
    public boolean displayPopup{get; set;}
    Public string contactemailid{get;set;}
    public boolean fileUpload{get;set;}
    public string RequestValue{get; set;}
    
    Public Provisional_Request_ctrl(){
        
      //Create New Record in Functional Request Obj Object      
        FormExtn = new Functional_Request__c ();
        caseformmap =  new Map<string,Functional_Request__c> ();
        Ocase = new case();        
        doc = new Document();
        doc = null;
       // UploadedDocumentList = new List<AttachmentsWrapper>();
        showlist = false;
        RenderFieldSetBlock = false;
        requesttype = 'None';
        iscentraloginisuue = 'false';
        RenderFunction = true;
        getfields();
        displayPopup = true;
        contactemailid = '';
        addAttachment = false;
        setpopdisplay = ''; 
        
        }
   
   public pagereference Cancel()
    {
        pageReference pg=new PageReference('https://domain.visual.force.com/apex/FRS_Request');
        pg.setRedirect(True);
        return pg;
    }
   
   
   // Get record types for  request forms and display in 'Request type'.
    
    
    Public void getfields(){
     
        if(String.IsNotEmpty(apexpages.currentpage().getparameters().get('Param1'))){
           RenderFieldSetBlock=true; 
           RenderFunction = false;
           requesttype = apexpages.currentpage().getparameters().get('Param1');
           formname=requesttype;
           requesttype = EncodingUtil.urlDecode(requesttype, 'UTF-8');
           FormExtn.TDR_Request_Type__c = requesttype ;   
           DlccategorySelection = '';
           system.debug('12784563' + requesttype);
           if(requesttype != 'None'){
               requesttype=requesttype.replace(' ','_').replace('(' , '').replace(')' , '').replace(',' , '_').replace('-' , '_').replace('/' , '_').replace('.' , '');
           }
           
           if(requesttype.length() > 41){
               
             requesttype = requesttype.substring(0,40);
             system.debug('@@@@@@@@@@@@' + requesttype );
             if(requesttype.endsWith('_')){
              requesttype= requesttype.removeEnd('_');
                              
             }
         }
       
       }
       
      }  
        
        
   // saverequest method is to save the request.
   
    Public PageReference saveRequest(){
                 
    try{
         pageError = false;
         pageErrorMessage = '';
         
        // If there is no validation error save the request.
              
          if(pageError == false){  
            
              RecordType rectype = new RecordType();
         
             string recrdtname; 
            
            system.debug('##'+RequestValue);
			
             if( RequestValue=='Provide_Access_Request')//referring fieldsets
             {
                         FormExtn.RecordTypeId = System.Label.Provide_Access_Request; //custom labels which has record typeIds in its value field
             
             }
             else
             if( RequestValue=='Other')
             {
                        FormExtn.RecordTypeId = System.Label.Other; 
                        fileUpload = true;
             }
             else
             if( RequestValue=='Package_Request')
             {
                         FormExtn.RecordTypeId = System.Label.Package_Request; 
             
             }
             
             
            
             
        //Insert Case
           try{
              Ocase = new case();
              Ocase.Status    = 'New';
              Ocase.Subject =  System.Label.TDR_Case_Subject;
              Ocase.Origin = System.Label.TDR_Case_Origin;
              Ocase.Description = apexpages.currentpage().getparameters().get('description') ;  
              Ocase.Contactid   = loggedInContact.id;             
              Ocase.Gen_Request_Type__c = RequestValue;
              Ocase.RecordTypeid   = System.Label.Provisional_RecordTypeId;
             
           // Assigning Case using Case-Assignment Rule.
             
             Database.DMLOptions dmlOpts = new Database.DMLOptions();
             dmlOpts.assignmentRuleHeader.assignmentRuleId= Label.Case_Assignment_Rule_Id ;
             dmlOpts.EmailHeader.TriggerUserEmail = true;
             Ocase.setOptions(dmlOpts); 
            
             Database.insert(Ocase, dmlOpts);
             
             system.debug('=========Case=======' + Ocase);
           
           // Insert Functional Request Obj. 
             FormExtn.Case_Form_App__c = System.Label.Case_Form_App;
             FormExtn.TDR_Employee__c  = loggedInContact.id;
             FormExtn.GEN_Case__c= Ocase.Id;
            
             system.debug('=========Form Extension=======' + FormExtn);
            
             Insert FormExtn;
        
             return new PageReference('/apex/AutoResponse_Page url); 
             }catch(Exception e){
             return null;
             }
          }
       
                 else{
           return null;
          }
}
catch(Exception ex){
system.debug('------getMessage----'+ex.getMessage()+'--------getLineNumber--------'+ex.getLineNumber());
 return null;
         }
        
    }
         
    
}

Thanks
Cvrk

 
Hi 
1) Is it possible to update a child record when its associated master record is updated with a particular value on after update trigger?if possible which trigger context variable best suits the requirement?
For Example: when ever a field FA1 is updated with a X value in the master object then a field FB1 should be updated with X value on after update event.
2) similarly is it possible to delete child record when a master record is updated on after update event?
Hi Everyone,
i have below trigger with both before insert and after insert events,Client__c (Master Obj) and Project__c(Detail Obj) with master detail relationship.
My requirement is when a ever a new client record is going to be inserted Quotation__c field has to be updated with the value that provided in the trigger,and i have an after insert event in the same trigger

After trigger is working as expected but my before trigger throwing following error
Error for the trigger

Trigger :

trigger AutoProjects on Client__c (before insert,After insert){
    
    If(trigger.isbefore)
    {
         list <Client__c>NewClnts=New List<Client__c>();
         for(Client__c Clnt:trigger.New)
         {
            Client__c c=new Client__c();
            C.Name=   //Need a value that says "the record that is going to be created with any name not a particular name"
            c.Assigned_To__c='chhakri;chetan';
            NewClnts.add(C);
         }
       Insert NewClnts;  
    }
   
   if(Trigger.isafter){
    List <Project__c> NewProjs= new List <Project__c> ();
        for(client__c Clnt:trigger.new)
        {
            Project__c p=new project__c();
            p.Name=Clnt.Name+'Project';
            p.Start_date__c=date.today();
            p.Client_Type__c='Silver';
            p.Client__c= clnt.Id;
            NewProjs.add(p);
        }
        Insert NewProjs;
    }
 }
 
Hi Everyone,
i have folder that has zip files or image files and uploaded as a static resource and called it on the VF page as includescript value="
{!URLFOR($Resource.assets, 'assets/js/jquery-ui.custom.min.js')}"

".now how should i make it working, i mean how to invoke it.
Hi
I am trying to find out what are the User licences and the standard profiles that come up with them in EE or UE,for this i have tried all the possible ways to signup for a free trial for EE by going to the oficial site and also the links by google but every time after registering via the links a professional edition was being created,so can someone give me or screen shot the list of User licenses and their related standard Profiles that come along with the respective edition like EE or UE if anyone have access to any of those editions.
 I read that trigger.new does not work for after insert/update triggers but i have seen in many examples where trigger.new is used in after triggers,so wondering if trigger.new works or not for after events in any situation.

below example trigger for the reference that used trigger.new for After Insert event .

trigger AutoOpp on Account(after insert) {
  List<Opportunity> newOpps = new List<Opportunity>();
  for (Account acc : Trigger.new) {
    Opportunity opp = new Opportunity();
    opp.Name        = acc.Name + ' Opportunity';
    opp.StageName   = 'Prospecting';
    opp.CloseDate   = Date.today() + 90;
    opp.AccountId   = acc.Id; // Use the trigger record's ID
    newOpps.add(opp);
  }
  insert newOpps;
}
Hi ,
1) Iam New to development,now trying to create a detail record as a result based on after record inserted on its master object,but i am failing to do so
Client__c is master object and project__c is Child Object,

Trigger code:

trigger AutoProjects on Client__c (After insert) {
    List <Project__c> NewProjs= new List <Project__c> ();
        for(client__c Clnt:trigger.new){
            Project__c p=new project__c();
            p.Name=Clnt.Name+'Project';
            p.Start_date__c=date.today();
            p.Client_Type__c='Silver';
            p.Project.Id=Clnt.Id;
            NewProjs.add(p);
        }
        Insert NewProjs;
    }

2) I read that trigger.new does not work for after insert/update triggers but i have seen in many examples where trigger.new is used in after triggers,so wondering if trigger.new works or not for after events in any situation.

below example trigger for the reference that used trigger.new for After Insert event .

trigger AutoOpp on Account(after insert) {
  List<Opportunity> newOpps = new List<Opportunity>();
  for (Account acc : Trigger.new) {
    Opportunity opp = new Opportunity();
    opp.Name        = acc.Name + ' Opportunity';
    opp.StageName   = 'Prospecting';
    opp.CloseDate   = Date.today() + 90;
    opp.AccountId   = acc.Id; // Use the trigger record's ID
    newOpps.add(opp);
  }
  insert newOpps;
}

 
Hi,
usually when master record is deleted detail(child) record will be deleted,but wondering,what happens to the detail record when either of the primary or secondary master record is deleted?,will child record be deleted or not?
Hi,
Dashboard is agraphical representation by using various components but ,once I get asked in how many ways a dashboard can be displayed,      but i wonder are there any ways to display a dashboard or the question suppose to be in which parts of the sfdc we can use dashboards.?
Hi,
Usually in realtime,In How many ways leads can be converted to Acounts,contacts and Opportunities(Optional)?

Thanks
 
Hi,
i have been reading about action tags,it make sense to me that,in few ways both Actionsup and actionfunc works similarly,so far have not found any example other than Onclickevent on actionsup and popup message when used action function.

Can someone provide me with few example situations where we can use only ActionFuc but not Actionsup and similarly only ActionSup works but not ActionFunc




 
hi,

I have created a custom button and a vf page to edit a record that is locked due to approval process. I wrote a trigger for auto approval process using after update and after insert events.The problem arises when i use after update in trigger.when i make some changes in the vf page and try saving it, it throws this error,
Visualforce ErrorHelp for this Page
System.DmlException: Update failed. First exception on row 0 with id 0069000000bgC3WAAU; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Approvalprocess1: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process.: [] Trigger.Approvalprocess1: line 12, column 1: []
Error is in expression '{!saveAs}' in component <apex:commandButton> in page edit_opportunity: Class.EditOpportunity.saveAs: line 38, column 1
Class.EditOpportunity.saveAs: line 38, column 1

This error does not occur when i use only after insert event. can anyone please help me ..