You need to sign in to do that
Don't have an account?
Joe Stolz
Most likely a simple question: How to pass a static value to a field?
Hello,
I am just learning Visualforce and am finding all sorts of uses for it in my Org. I was given a request for a simple way for internal users to submit cases to a queue. This led me to create a quick Visualfoce page, which works, except for assigning the case to a queue. Could someone help me with how to assign a case completed on this VF page to a specific queue?
The queue Id is 00Gi00000043ioY.
Thank you,
Joe Stolz
I am just learning Visualforce and am finding all sorts of uses for it in my Org. I was given a request for a simple way for internal users to submit cases to a queue. This led me to create a quick Visualfoce page, which works, except for assigning the case to a queue. Could someone help me with how to assign a case completed on this VF page to a specific queue?
<apex:page standardController="Case" showHeader="true" sidebar="true"> <apex:form id="theForm"> <apex:pageBlock title="Submit your CP support requests below" id="casePageBlock" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!save}" id="theButton"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection id="masterPageBlock" title="Master" showHeader="false"> <apex:inputField id="casTyp" value="{!Case.Type_of_Request__c}"/> <apex:inputField id="casOwn" label="Owner" value="{!case.OwnerId}" rendered="false"/> </apex:pageBlockSection> <apex:pageBlockSection id="thePageBlock" title="The Fields" showHeader="false" columns="2"> <apex:inputField id="casAcc" label="CP's Account Name" required="true" value="{!case.AccountId}"/> <apex:inputField id="casCon" label="Who is your contact?" value="{!case.ContactId}"/> <apex:inputField id="casOpp" label="What opportunity is this related to?" value="{!case.Related_Opportunity__c}"/> <apex:inputField id="casPri" label="What is the priority of this request" required="true" value="{!case.Priority}"/> <apex:inputField id="casDes" label="Please describe what you would like done" required="true" value="{!case.Description}"/> </apex:pageBlockSection> </apex:actionRegion> </apex:pageBlock> </apex:form> </apex:page>
The queue Id is 00Gi00000043ioY.
Thank you,
Joe Stolz
public class CustomCaseController{
Case c {get; set;} //custom case variable to be used for vf page
//controller method for controller class to default the case ownerid to the queue.
public CustomCaseController(){
c = new Case();
c.OwnerId = '00Gi00000043ioY';
}
}
From your VF page, you would replace all inputfield value attributes with the custom controller's case variable instead of using the standard controller. For instance,
<apex:inputField id="casOwn" label="Owner" value="{!c.OwnerId}" rendered="false"/>
Another non-code workaround could be handling the owner assignment after the case has been created. So you can create a workflow rule or Process Builder flow that will re-assign the owner owner of the case at creation. You can probably also look into assignment rules as well.
All Answers
This link can help you about assigning queues,
http://prosenjit-sarkar-sfdc.blogspot.in/2015/07/assigning-supported-object-users-to.html (http://prosenjit-sarkar-sfdc.blogspot.in/2015/07/assigning-supported-object-users-to.html" target="_blank)
No, my requirements are for more of a custom solution than what global actions would allow.
public class CustomCaseController{
Case c {get; set;} //custom case variable to be used for vf page
//controller method for controller class to default the case ownerid to the queue.
public CustomCaseController(){
c = new Case();
c.OwnerId = '00Gi00000043ioY';
}
}
From your VF page, you would replace all inputfield value attributes with the custom controller's case variable instead of using the standard controller. For instance,
<apex:inputField id="casOwn" label="Owner" value="{!c.OwnerId}" rendered="false"/>
Another non-code workaround could be handling the owner assignment after the case has been created. So you can create a workflow rule or Process Builder flow that will re-assign the owner owner of the case at creation. You can probably also look into assignment rules as well.