• Nagothi
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

Hi,

    My current flow is as follows

    1) User clicks a button from Account Page Layout --> it lands on Custom VF Page 

    2) User clicks a button on VF page --> it will land on Case Page

   

     Issue: I need to auto fill Case custom field "ParentName" and standard field "Subject" (cas14) on Case Page Layout

 

My current custom controller code

 

public PageReference test(){
 PageReference hierarchyChangeCasePage;
 String myRecId = ApexPages.currentPage().getParameters().get('Id');
 String curPgURL = ApexPages.currentPage().getURL();

hierarchyChangeCasePage = new PageReference('/500/e?def_account_id='+myRecId+'&cas14=My Custom Subject&ent=Case&00NP0000000XF3z='+parentName+'&RecordType='+selectedHierarchyValue+'&nooverride=1');    

return hierarchyChangeCasePage.setRedirect(true);

}                                        

 In my debug logs, i dont see cas14 and  00NP0000000XF3z are passed to Case Page Layout in URL Query String.

Can anyone pl. help me how to autofill Case fields from a VF page?

 

Thanks

Mallesh

 

Task:

User navigation will be Click on any existing Account --> click a custom button --> which will land on my visual source page --> here user selects an option and clicks a button --> whcih should land on Create Case Page

 

I came up with the following  Visual Force Page

-----------------My Visual Force Page code----------------------------

<apex:page standardController="Account" recordSetVar="accounts" extensions="changeHierarchyCaseController">
    <apex:form >
       <p>
       <H1> Select Hierarchy Change Reason for selected Account: {!account.name}</H1> 
       </p>
       <apex:selectCheckboxes value="{!hierarchyOptions}">
           <apex:selectOptions value="{!changeHierarchyOptions}">
           </apex:selectOptions>
       </apex:selectCheckboxes>    <br/>
       <apex:commandbutton value="Create Change Hierarchy Case" action="{!test}" rerender="out" status="status"/>
    </apex:form>
</apex:page>

 -----------------End of Visual Force Page------------------------------

------------------ My Controller Code to Support Above VF----------

public with sharing class changeHierarchyCaseController {

    ApexPages.StandardSetController setCon;
    String[] hierarchyOptions = new String[]{};
    
    public Account getAccount(){
        return [SELECT Id, Name FROM Account
                WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
                
    }
    public changeHierarchyCaseController(ApexPages.StandardSetController controller) {
        setCon = controller;
    }
    
    public PageReference test() {
        
           PageReference hierarchyChangeCasePage = new PageReference('/500/e?def_account_id={!$Account.Id}&RecordType=012P00000004TuI&ent=Case&nooverride=1');
           //?def_account_id='+account.Id+'&RecordType=012P00000004TuI&ent=Case&nooverride=1');
           //hierarchyChangeCasePage.getParameters().put('def_account_id','='+account.Id);
           //hierarchyChangeCasePage.getParameters().put('RecordType','012P00000004TuI');
           //hierarchyChangeCasePage.getParameters().put('ent','Case');
           //hierarchyChangeCasePage.getParameters().put('nooverride','1');
           return hierarchyChangeCasePage.setRedirect(true);
    }
  
    public List<SelectOption> getChangeHierarchyOptions(){
        List<SelectOption> hierarchyOptions = new List<SelectOption>();
        hierarchyOptions.add(new SelectOption('AddChild', 'Add/Modify Parent'));
        hierarchyOptions.add(new SelectOption('RemoveChild', 'Remove Parent'));
        hierarchyOptions.add(new SelectOption('Modify Parent', 'Add Child'));
        hierarchyOptions.add(new SelectOption('RemoveParent', 'Remove All Children'));

        return hierarchyOptions ;   
    
    }//End getChangeHierarchyOptions
    
    public String[] getHierarchyOptions(){
        return hierarchyOptions;
    }
    
    public void setHierarchyOptions(String[] hierarchyOptions){
        this.hierarchyOptions = hierarchyOptions;   
    } 

}

 Issue:

Unable to Access Page
The value of the "def_account_id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information. 

 If i change code to following, it is landing on Case View page, and displaying Case Record Types in a drop down

I've changed /500/e?def_account_id  to /500?def_account_id (removed /e)

 PageReference hierarchyChangeCasePage = new PageReference('/500?def_account_id={!$Account.Id}&RecordType=012P00000004TuI&ent=Case&nooverride=1');

Can anybody help me to achive this? I might be making a dumb mistake, pl. execuse me, am new bea to SF

 

Thanks

Mallesh 

 

 

 

Task:

User navigation will be Click on any existing Account --> click a custom button --> which will land on my visual source page --> here user selects an option and clicks a button --> whcih should land on Create Case Page

 

I came up with the following  Visual Force Page

-----------------My Visual Force Page code----------------------------

<apex:page standardController="Account" recordSetVar="accounts" extensions="changeHierarchyCaseController">
    <apex:form >
       <p>
       <H1> Select Hierarchy Change Reason for selected Account: {!account.name}</H1> 
       </p>
       <apex:selectCheckboxes value="{!hierarchyOptions}">
           <apex:selectOptions value="{!changeHierarchyOptions}">
           </apex:selectOptions>
       </apex:selectCheckboxes>    <br/>
       <apex:commandbutton value="Create Change Hierarchy Case" action="{!test}" rerender="out" status="status"/>
    </apex:form>
</apex:page>

 -----------------End of Visual Force Page------------------------------

------------------ My Controller Code to Support Above VF----------

public with sharing class changeHierarchyCaseController {

    ApexPages.StandardSetController setCon;
    String[] hierarchyOptions = new String[]{};
    
    public Account getAccount(){
        return [SELECT Id, Name FROM Account
                WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
                
    }
    public changeHierarchyCaseController(ApexPages.StandardSetController controller) {
        setCon = controller;
    }
    
    public PageReference test() {
        
           PageReference hierarchyChangeCasePage = new PageReference('/500/e?def_account_id={!$Account.Id}&RecordType=012P00000004TuI&ent=Case&nooverride=1');
           //?def_account_id='+account.Id+'&RecordType=012P00000004TuI&ent=Case&nooverride=1');
           //hierarchyChangeCasePage.getParameters().put('def_account_id','='+account.Id);
           //hierarchyChangeCasePage.getParameters().put('RecordType','012P00000004TuI');
           //hierarchyChangeCasePage.getParameters().put('ent','Case');
           //hierarchyChangeCasePage.getParameters().put('nooverride','1');
           return hierarchyChangeCasePage.setRedirect(true);
    }
  
    public List<SelectOption> getChangeHierarchyOptions(){
        List<SelectOption> hierarchyOptions = new List<SelectOption>();
        hierarchyOptions.add(new SelectOption('AddChild', 'Add/Modify Parent'));
        hierarchyOptions.add(new SelectOption('RemoveChild', 'Remove Parent'));
        hierarchyOptions.add(new SelectOption('Modify Parent', 'Add Child'));
        hierarchyOptions.add(new SelectOption('RemoveParent', 'Remove All Children'));

        return hierarchyOptions ;   
    
    }//End getChangeHierarchyOptions
    
    public String[] getHierarchyOptions(){
        return hierarchyOptions;
    }
    
    public void setHierarchyOptions(String[] hierarchyOptions){
        this.hierarchyOptions = hierarchyOptions;   
    } 

}

 Issue:

Unable to Access Page
The value of the "def_account_id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information. 

 If i change code to following, it is landing on Case View page, and displaying Case Record Types in a drop down

I've changed /500/e?def_account_id  to /500?def_account_id (removed /e)

 PageReference hierarchyChangeCasePage = new PageReference('/500?def_account_id={!$Account.Id}&RecordType=012P00000004TuI&ent=Case&nooverride=1');

Can anybody help me to achive this? I might be making a dumb mistake, pl. execuse me, am new bea to SF

 

Thanks

Mallesh 

 

 

 

Hi all, This is a very urgent requirement for me .I want a process where an email will be triggered to the user when he is added to a account team.I have tried with the workflow rule but not get success.For apex trigger can not be written on Account Team Member object.Please provide the solution.
Hi
can you tell me what is the method for getting current user's profile name in apex class.
 
In visualforce page, we can use    {!$Profile.Name}  
 
 
 
it gives current profile name but i want a relavant method  in apex code.
 
Thanks & Regards
Brijesh Kumar Baser