-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
10Questions
-
6Replies
Display Field Based on Picklist Value in Previous Field
I am kind of new to Visualforce and apex ... and am trying to create something that should be fairly simple. Basically, I want to ask the user for the Preferred Communication Contact in a case. If they answer with the picklist value of "Client Contact", I then want to display a field that will require them to choose the client contact. I don't want that field to display on any other picklist value though.
I've looked through the boards and have figured out that I need to use a "rendered" attribute ... but no matter what I've done I can't seem to make this work. If someone can help me with the exact coding (and the "why", so I can actually "get it" in my brain), that would be great.
Not sure where the update needs to be made .. the page? The custom controller? Both? I've messed with the custom controller, the VF page and both ... but still can't get the field to display. I won't post everything I've tried ... but here's what I've got so far at this moment.
VF Page:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <style type = "text/css"> .labelText {font-weight:bold; font-size:11px} .fieldText {font-weight:bolder; font-size:12px; color: #FF0000} </style> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{!step3}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputLabel styleClass="labelText" value="Account Name"/> <apex:outputText styleClass="fieldText" value="{!accountName}"/> <apex:outputLabel styleClass="labelText" value="Global Region"/> <apex:outputText styleClass="fieldText" value="{!globalRegion}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Product_Service__c}" required="True"/> <apex:inputField value="{!AssistanceRequest.Category__c}" required="True"/> <apex:inputField value="{!AssistanceRequest.Action__c}" required="True"/> </apex:pageBlockSection> <apex:pageBlockSection title="Case Contact Information" columns="1" id="contactInfo"> <apex:inputField value="{!AssistanceRequest.Preferred_Communication_Contact__c}" required="True"/> <apex:inputField value="{!AssistanceRequest.Client_Contact__c}" rendered="{!Assistance_Request__c.Preferred_Communication_Contact__c == 'Client Contact'}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Custom Controller (do I need to do anything with this at all to make it work?)
public with sharing class ARWizard { public ApexPages.standardController controller {get; set;} public Assistance_Request__c assistanceRequest {get; set;} public Account account {get;set;} public ID accountID {get;set;} public string globalRegion {get;set;} public string accountName {get;set;} public ARWizard (ApexPages.standardController controller) { if (assistanceRequest == null) assistanceRequest = new Assistance_Request__c(); } public PageReference step1() { return Page.arStep1; } public PageReference step2() { try { account = [SELECT Id,Name,Global_Region__c FROM Account WHERE Id =: assistanceRequest.Account_Name__c]; globalRegion = account.Global_Region__c; accountName = account.Name; } catch(Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage())); } return Page.arStep2; } public PageReference step3() { return Page.arStep3; } public PageReference save() { System.debug('&&&&&&& Account=' + account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
Thanks in advance!
- tlsarna1
- December 14, 2011
- Like
- 0
Workflow Filter of Case Owner Profile
HI ... requested this before, but the fix didn't work as expected and I'm hoping that someone may have an answer. I am trying to build a time-based workflow that will replace a manual process kicked off by reporting. Currently, we are running a scheduled report to let us know how many cases have not been submitted to our team. The report filters on:
Case Record Type equals XYZ
Closed equals False
Date/Time Created equals > 10 days
Case Owner Profile does not equal TEAM
This is working great ... but the process for contacting the requesters is manual and we want to automate it. The problem is that I cannot find a place in the workflow rule to check the Case Owner Profile. The last suggestion was to create a new custom formula field that would populate the profile based on the Case Owner, but all I can grab is the Owner ID and can't find a way to capture any other information from that user profile.
There are too many people on the team to manage actual names (Case Owner contains) ... is there any other workaround for this?
- tlsarna1
- November 10, 2011
- Like
- 0
Closing Cases via Data Loader?
I need to close a bulk of cases (700+) via Data Loader. I want to change the Status to a closed status and the Case Owner name, and have the system recognize the cases as closed today.
I am able to map the Status field and the Case Owner field to change them ... but do not see the option to modify the IsClosed field or the Date/Time Closed field in Data Loader. In fact, I don't see the Date/Time Opened field either ... almost like I am unable to modify any "system" generated fields in Data Loader.
Is this true? Are we not able to close cases? Is there a workaround?
- tlsarna1
- October 25, 2011
- Like
- 0
Time-Based Workflow Rule Based on Case Owner Profile?
I am trying to build a time-based workflow, based on the date created. Basically, if our requesters don't complete our case correctly, the assignment rules won't kick off and the case will stay assigned to the requester. Currently, we are running a scheduled report to let us know how many of these cases are out there. The report is based on :
Case Record Type equals XYZ
Closed equals False
Date/Time Created equals > 10 days
Case Owner Profile does not equal TEAM
This is working great ... but now the team would like to build a workflow rule to automatically send the email that they've been sending manually based on this report. However, I cannot find a place in the workflow rule to check the Case Owner Profile. There are too many people on the team to manage actual names (Case Owner contains) ... is there any workaround for this?
- tlsarna1
- October 25, 2011
- Like
- 0
Completely Frustrated and Feel Like Crying ... Trying to Pull Field from Account Record
I'm honestly starting to wonder whether I will EVER get this .... here's what I'm trying to do:
1./ Ask user for Account Name on page 1 of wizard
2./ Display account name chosen AS WELL AS value of custom field on that account record on page 2 of wizard.
3./ Ask user for Request Type, Category and Action on page 2 of wizard. The picklist options in the Request Type, Category and Action fields will be based on the value of the custom field (Global Region) in the account record.
I am COMPLETELY FRUSTRATED and lost in trying to get this to work. It just seems like it should be SOOO simple ... although I'm new to Apex, I know other programming languages ... why is this so difficult to grasp?
If anyone can help, I would be forever grateful. And please ... give me notes and reasons why I'm doing things ... others have tried to help by just giving me links to other wizards, but because those wizards aren't doing what I want to do, they don't help me understand how to build mine.
Thanks ...
Current Custom Controller Code
public class ARWizard { public ApexPages.standardController controller {get; set;} public Assistance_Request__c assistanceRequest { get; set; } public Account account {get;set;} public ID accountID {get;set;} public ARWizard (ApexPages.standardController controller) { //Added by Lokesh if(assistanceRequest ==null) assistanceRequest = new Assistance_Request__c(); } public PageReference step1() { return Page.arStep1; } public PageReference step2() { try { account = [SELECT Id,Name,Global_Region__c FROM Account WHERE Id =: AssistanceRequest.Account_Name__c]; } catch(Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage())); } return Page.arStep2; } public PageReference save() { System.debug('&&&&&&& Account=' + account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
Current Page 1 Code:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Current Page 2 Code:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!AssistanceRequest.Account_Name__c}"/> <apex:outputField value="{!AssistanceRequest__r.Account.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- tlsarna1
- October 19, 2011
- Like
- 0
Carry Variable Across Multiple Wizard Pages
So ... when I went to training about 6 months ago, they told me to make sure I set myself up for "little successes". Now, I know why ... because I have already run into a stickler on my first piece of code that is beyond frustrating!!
I've created a custom object, a controller extension and two VF pages, which will serve as the beginning of a wizard. I want to be able to choose the Account Name in the first page of the wizard, and then have that Account Name and the corresponding Global Region (custom) field from the Account object display on the 2nd page of the wizard. But no matter what I do I can't get the Account name to move from page 1 to page 2.
Here's the code I have so far ... I'm sure it's something simple ...
Thanks in advance for your help!! I'm going to post this in both the VF discussion forum and the Apex one, just in case ....
Controller Extension:
public with sharing class ARWizard { // First declare all properties that will be used to maintain the state of the wizard. // Search results are not transient in case the user accidentally selects the wrong one and wants to go back. // First property is the standard controller, called controller, // so that in read mode it will work as object is built. public ApexPages.standardController controller {get; set;} // Next is an Assistance Request variable called assistanceRequest to insert when we're done public Assistance_Request__c assistanceRequest { get; set; } // Next property is the Account, referenced by the variable called account with default getter/setter public Account account {get;set;} // Next property is the Account ID called "accountId" with default getter/setter public ID accountID {get;set;} // Now I have to build a constructor to create the Assistance Request public ARWizard (ApexPages.standardController controller) { } // The next 2 methods control navigation through the wizard. // Each returns a PageReference for one of the 2 pages in the wizard. // Note that the redirect attribute does not need to be set on the PageReference // because the URL does not need to change when users move from page to page. // First is a method called "step1" to return the page reference for the ARStep1 page public PageReference step1() { return Page.arStep1; } // Next is a method called "step2" to get the account and then return the page reference for the ARStep2 page public PageReference step2() { try { account = [SELECT Id,Name,Global_Region__c FROM Account WHERE Id =: assistanceRequest.Account_Name__c]; } catch(Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage())); } return Page.arStep2; } public PageReference save() { System.debug('&&&&&&& Account=' + account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
Page 1:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Page 2:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!Assistance_Request__c.Account_Name__c}"/> <apex:outputField value="{!Assistance_Request__c.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- tlsarna1
- October 03, 2011
- Like
- 0
Carrying Variable Across Wizard Screens and Reading from Object
So ... when I went to training about 6 months ago, they told me to make sure I set myself up for "little successes". Now, I know why ... because I have already run into a stickler on my first piece of code that is beyond frustrating!!
I've created a custom object, a controller extension and two VF pages, which will serve as the beginning of a wizard. I want to be able to choose the Account Name in the first page of the wizard, and then have that Account Name and the corresponding Global Region (custom) field from the Account object display on the 2nd page of the wizard. But no matter what I do I can't get the Account name to move from page 1 to page 2.
Here's the code I have so far ... I'm sure it's something simple ...
Thanks in advance for your help!! I'm going to post this in both the VF discussion forum and the Apex one, just in case ....
Controller Extension:
public with sharing class ARWizard { // First declare all properties that will be used to maintain the state of the wizard. // Search results are not transient in case the user accidentally selects the wrong one and wants to go back. // First property is the standard controller, called controller, // so that in read mode it will work as object is built. public ApexPages.standardController controller {get; set;} // Next is an Assistance Request variable called assistanceRequest to insert when we're done public Assistance_Request__c assistanceRequest { get; set; } // Next property is the Account, referenced by the variable called account with default getter/setter public Account account {get;set;} // Next property is the Account ID called "accountId" with default getter/setter public ID accountID {get;set;} // Now I have to build a constructor to create the Assistance Request public ARWizard (ApexPages.standardController controller) { } // The next 2 methods control navigation through the wizard. // Each returns a PageReference for one of the 2 pages in the wizard. // Note that the redirect attribute does not need to be set on the PageReference // because the URL does not need to change when users move from page to page. // First is a method called "step1" to return the page reference for the ARStep1 page public PageReference step1() { return Page.arStep1; } // Next is a method called "step2" to get the account and then return the page reference for the ARStep2 page public PageReference step2() { try { account = [SELECT Id,Name,Global_Region__c FROM Account WHERE Id =: assistanceRequest.Account_Name__c]; } catch(Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage())); } return Page.arStep2; } public PageReference save() { System.debug('&&&&&&& Account=' + account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
Page 1:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Page 2:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!Assistance_Request__c.Account_Name__c}"/> <apex:outputField value="{!Assistance_Request__c.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- tlsarna1
- October 03, 2011
- Like
- 0
Pass Value from One Wizard Page to Another
I am brand new to VF and Apex, and am trying to figure out how to create what should be a very simple wizard. Basically, here's what I want to do:
Page 1:
* Allow the user to choose an Account from a list of all the Accounts in the system (via a Lookup field).
I think I got this okay --- but maybe I'm doing it wrong.
Page 2:
* Display the Account chosen and the value of the Global Region custom field from that Account. (Can't get this to happen AT ALL)
* Based on that Global Region field, offer specific value options for a Product picklist field
(if Global Region == A, offer 1, 2, 3 if Global Region ==B, offer 4, 5, 6 if Global Region==C, offer 1, 3, 5
* Save record and display Account, Global Region and Product.
I think I have to use SelectOption, but again --- I am brand new out of training, trying to document everything that I do based on what I learned there, and don't remember learning that. Is anyone willing to help me out (and explain what you're doing in "regular" language rather than "programmer-to-programmer)?
Thanks!
VF Page 1:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Choose Account" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
VF Page 2:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{step3}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!Account.Name}"/> <apex:outputField value="{!Account.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Controller Code:
public with sharing class ARWizard { // First declare all properties that will be used to maintain the state of the wizard. // Search results are not transient in case the user accidentally selects the wrong one and wants to go back. // First property is the standard controller, called controller, // so that in read mode it will work as object is built. public ApexPages.standardController controller {get; set;} // Next is an Assistance Request variable called assistanceRequest to insert when we're done public Assistance_Request__c assistanceRequest { get; set; } // Next property is the Account, referenced by the variable called account with default getter/setter public Account account {get;set;} // Next property is the Account ID called "accountId" with default getter/setter public ID accountID {get;set;} // Now I have to build a constructor to create the Assistance Request public ARWizard (ApexPages.StandardController standardcontroller) { } // The next 3 methods control navigation through the wizard. // Each returns a PageReference for one of the 3 pages in the wizard. // Note that the redirect attribute does not need to be set on the PageReference // because the URL does not need to change when users move from page to page. // First is a method called "step1" to return the page reference for the ARStep1 page public PageReference step1() { return Page.arStep1; } // Next is a method called "step2" to return the page reference for the ARStep2 page public PageReference step2() { return Page.arStep2; } // Next is a method called "step3" that validates that the Account Name is not null // This method is called by step2 & step3 pages in the action attribute, // in case anyone tries to go directly to them it will navigate the user back to step1 public PageReference step3() { if (Account.Name == null) { Account.Name.addError('Please choose an Account.'); return null; } else { return Page.arStep3; } } public PageReference save() { System.debug('Account=' + Account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
- tlsarna1
- September 23, 2011
- Like
- 0
Flow and Dependent Picklists
I'm new at VF and Flow, scouring through my guides and feeling a little overwhelmed. I posted a message on the VF page but also know that I may be able to do this with Flow. Here's what I want to do:
1./ Allow a user to choose an Account from a lookup search (easy enough, although I'd like the lookup to be in a dropdown, based on search criteria rather than radio button options of ALL accounts)
2./ Based on the global region (field is Global_Region__c) in that account, give the option for a category, sub-category and action of a case. Some regions don't support all functions, so will need the opportunity to have a picklist dependent on the region.
For example:
Category: Hardware, Software, Accessories
Sub-Category: Monitor, Mouse, Keyboard, Windows, Office, iTunes, Speakers, Patch Cables, Adapters
Action: Repair, Consult, Replace, Reconfigure, Reimage, Reinstall, Install, Deinstall
Choose ABC with the global region of North America and options may be:
Hardware --> Monitor, Mouse, Keyboard
Software ---> Windows, Office, iTunes
Action ---> Reimage, Reinstall, Consult, Deinstall
But choose ABC with the global region of JAPA and the options may be
Hardware ---> Mouse, Keyboard
Software --> Office
Action ---> Consult
Likewise with LAC and EMEA --- the dependent picklists will change, based on what is supported in the region. Can this be done? How? Originally, we had 15 different record types with picklist value changes for each ... but we want to merge into a single record type for all regions, just displaying what is applicable to that region. Can this all be done using Flow?
- tlsarna1
- September 22, 2011
- Like
- 0
Visualforce and IF Statements for Dependent Picklists
I'm new at VF and scouring through my 450+ page guide, a little overwhelmed. Here's what I want to do:
1./ Allow a user to choose an Account from a lookup search (easy enough)
2./ Based on the global region (field is Global_Region__c) in that account, give the option for a category, sub-category and action of a case. Some regions don't support all functions, so will need the opportunity to have a picklist dependent on the region.
For example:
Category: Hardware, Software, Accessories
Sub-Category: Monitor, Mouse, Keyboard, Windows, Office, iTunes, Speakers, Patch Cables, Adapters
Action: Repair, Consult, Replace, Reconfigure, Reimage, Reinstall, Install, Deinstall
Choose ABC with the global region of North America and options may be:
Hardware --> Monitor, Mouse, Keyboard
Software ---> Windows, Office, iTunes
Action ---> Reimage, Reinstall, Consult, Deinstall
But choose ABC with the global region of JAPA and the options may be
Hardware ---> Mouse, Keyboard
Software --> Office
Action ---> Consult
Likewise with LAC and EMEA --- the dependent picklists will change, based on what is supported in the region. Can this be done? How? Originally, we had 15 different record types with picklist value changes for each ... but we want to merge into a single record type for all regions, just displaying what is applicable to that region. Do I need to create a bunch of different fields, or can I just use VF and Apex?
- tlsarna1
- September 22, 2011
- Like
- 0
Closing Cases via Data Loader?
I need to close a bulk of cases (700+) via Data Loader. I want to change the Status to a closed status and the Case Owner name, and have the system recognize the cases as closed today.
I am able to map the Status field and the Case Owner field to change them ... but do not see the option to modify the IsClosed field or the Date/Time Closed field in Data Loader. In fact, I don't see the Date/Time Opened field either ... almost like I am unable to modify any "system" generated fields in Data Loader.
Is this true? Are we not able to close cases? Is there a workaround?
- tlsarna1
- October 25, 2011
- Like
- 0
Time-Based Workflow Rule Based on Case Owner Profile?
I am trying to build a time-based workflow, based on the date created. Basically, if our requesters don't complete our case correctly, the assignment rules won't kick off and the case will stay assigned to the requester. Currently, we are running a scheduled report to let us know how many of these cases are out there. The report is based on :
Case Record Type equals XYZ
Closed equals False
Date/Time Created equals > 10 days
Case Owner Profile does not equal TEAM
This is working great ... but now the team would like to build a workflow rule to automatically send the email that they've been sending manually based on this report. However, I cannot find a place in the workflow rule to check the Case Owner Profile. There are too many people on the team to manage actual names (Case Owner contains) ... is there any workaround for this?
- tlsarna1
- October 25, 2011
- Like
- 0
Completely Frustrated and Feel Like Crying ... Trying to Pull Field from Account Record
I'm honestly starting to wonder whether I will EVER get this .... here's what I'm trying to do:
1./ Ask user for Account Name on page 1 of wizard
2./ Display account name chosen AS WELL AS value of custom field on that account record on page 2 of wizard.
3./ Ask user for Request Type, Category and Action on page 2 of wizard. The picklist options in the Request Type, Category and Action fields will be based on the value of the custom field (Global Region) in the account record.
I am COMPLETELY FRUSTRATED and lost in trying to get this to work. It just seems like it should be SOOO simple ... although I'm new to Apex, I know other programming languages ... why is this so difficult to grasp?
If anyone can help, I would be forever grateful. And please ... give me notes and reasons why I'm doing things ... others have tried to help by just giving me links to other wizards, but because those wizards aren't doing what I want to do, they don't help me understand how to build mine.
Thanks ...
Current Custom Controller Code
public class ARWizard { public ApexPages.standardController controller {get; set;} public Assistance_Request__c assistanceRequest { get; set; } public Account account {get;set;} public ID accountID {get;set;} public ARWizard (ApexPages.standardController controller) { //Added by Lokesh if(assistanceRequest ==null) assistanceRequest = new Assistance_Request__c(); } public PageReference step1() { return Page.arStep1; } public PageReference step2() { try { account = [SELECT Id,Name,Global_Region__c FROM Account WHERE Id =: AssistanceRequest.Account_Name__c]; } catch(Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage())); } return Page.arStep2; } public PageReference save() { System.debug('&&&&&&& Account=' + account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
Current Page 1 Code:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Current Page 2 Code:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!AssistanceRequest.Account_Name__c}"/> <apex:outputField value="{!AssistanceRequest__r.Account.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- tlsarna1
- October 19, 2011
- Like
- 0
Pass Value from One Wizard Page to Another
I am brand new to VF and Apex, and am trying to figure out how to create what should be a very simple wizard. Basically, here's what I want to do:
Page 1:
* Allow the user to choose an Account from a list of all the Accounts in the system (via a Lookup field).
I think I got this okay --- but maybe I'm doing it wrong.
Page 2:
* Display the Account chosen and the value of the Global Region custom field from that Account. (Can't get this to happen AT ALL)
* Based on that Global Region field, offer specific value options for a Product picklist field
(if Global Region == A, offer 1, 2, 3 if Global Region ==B, offer 4, 5, 6 if Global Region==C, offer 1, 3, 5
* Save record and display Account, Global Region and Product.
I think I have to use SelectOption, but again --- I am brand new out of training, trying to document everything that I do based on what I learned there, and don't remember learning that. Is anyone willing to help me out (and explain what you're doing in "regular" language rather than "programmer-to-programmer)?
Thanks!
VF Page 1:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Choose Account" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step2}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="1"> <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
VF Page 2:
<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c"> <script> function confirmCancel(){ var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/> <apex:form > <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Previous"/> <apex:commandButton action="{step3}" value="Next"/> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Information" columns="2"> <apex:outputField value="{!Account.Name}"/> <apex:outputField value="{!Account.Global_Region__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Request Information" columns="2"> This is where the request product, category and action will go. </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Controller Code:
public with sharing class ARWizard { // First declare all properties that will be used to maintain the state of the wizard. // Search results are not transient in case the user accidentally selects the wrong one and wants to go back. // First property is the standard controller, called controller, // so that in read mode it will work as object is built. public ApexPages.standardController controller {get; set;} // Next is an Assistance Request variable called assistanceRequest to insert when we're done public Assistance_Request__c assistanceRequest { get; set; } // Next property is the Account, referenced by the variable called account with default getter/setter public Account account {get;set;} // Next property is the Account ID called "accountId" with default getter/setter public ID accountID {get;set;} // Now I have to build a constructor to create the Assistance Request public ARWizard (ApexPages.StandardController standardcontroller) { } // The next 3 methods control navigation through the wizard. // Each returns a PageReference for one of the 3 pages in the wizard. // Note that the redirect attribute does not need to be set on the PageReference // because the URL does not need to change when users move from page to page. // First is a method called "step1" to return the page reference for the ARStep1 page public PageReference step1() { return Page.arStep1; } // Next is a method called "step2" to return the page reference for the ARStep2 page public PageReference step2() { return Page.arStep2; } // Next is a method called "step3" that validates that the Account Name is not null // This method is called by step2 & step3 pages in the action attribute, // in case anyone tries to go directly to them it will navigate the user back to step1 public PageReference step3() { if (Account.Name == null) { Account.Name.addError('Please choose an Account.'); return null; } else { return Page.arStep3; } } public PageReference save() { System.debug('Account=' + Account); try{ insert assistanceRequest; } catch (System.DmlException e) { ApexPages.addMessages(e); return null; } controller = new ApexPages.standardController(assistanceRequest); return controller.view(); } }
- tlsarna1
- September 23, 2011
- Like
- 0