You need to sign in to do that
Don't have an account?
Jntshumaker
Setting the Owner of a Record
I'm trying to set the value of a visulaforce input field (Case.Owner) to the user creating the record, how would I go about doing this?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
I'm trying to set the value of a visulaforce input field (Case.Owner) to the user creating the record, how would I go about doing this?
There are two options for you,
1) Just remove the
<apex:inputField value="{!case.ownerID}"/>
from page then ownerid will be set to current user id.
2) Use custom contrller class and create a method to save case then you can use the code that i gave in earlier post.
All Answers
If you want to set the owner of case to current user
if any other particular user then
here userObj is the user which you want to make owner
Within the framework of a visualforce page, where does this go? Below is a snippet of my existing page:
This will show on page as a lookup field which will open a lookup window for user selection.
I understand that my existing code just displays a lookup field for the user to input a value, however i want to use the code you supplied in the second post to set the owner of the case as the "running user".
There are two options for you,
1) Just remove the
<apex:inputField value="{!case.ownerID}"/>
from page then ownerid will be set to current user id.
2) Use custom contrller class and create a method to save case then you can use the code that i gave in earlier post.
Thanks, just removing it from the "create new" VF page is what I did. Since (by default) that field is read only until the record is created, i'm just going to make it a part of the process, that whoever creates a case is the owner of that case, unless you note otherwise after creation.