+ Start a Discussion
kmorf_entransformkmorf_entransform 

creating new project

hi im new to salesforce. I was wondering how i could create a new project object using a custom visualforce page.

How do i get the UserName, LastName, Email, Alias, CommunityNickName, TimeZoneSidKey, LocalSidKey, EmailEncodingKey, profileId, LanguageLocalKey in order to insert the new record

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

If you are using inputField like as used in my example above then you don't need to do anything. When you add a value in picklist it automatically be displayed on visualforce page.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Am bit not clear with the requirement. When you say you need to insert Alias , CommunityNickName etc you mean you want to insert an user via visualforce page.

 

Or you have an object "Project" and want to insert a record of it via visualforce page?

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

kmorf_entransformkmorf_entransform

I have an object "Project" and want to insert it via visualforce.

Ankit AroraAnkit Arora

Just to keep it simple I have used standardcontroller on it.

 

Here is the code :

 

<apex:page standardController="Project__c">
<apex:form>
    <apex:pageBlock>
        <apex:pageBlockButtons>    
            <apex:commandButton value="Save" action="{!Save}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection>
            <apex:pageBlockSectionItem>
                <apex:outputLabel value="Name"/>
                <apex:inputField value="{!Project__c.Name}"/>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

 Just replace the object API name with Project__c in code.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

kmorf_entransformkmorf_entransform

what if u wanted to dynamically change a picklist value of the Project__c object. for example, Project__c has a field called status and status is a picklist. status has three values, say, completed, in progress, stopped. what if someone wants to add another value "terminated".

Ankit AroraAnkit Arora

If you are using inputField like as used in my example above then you don't need to do anything. When you add a value in picklist it automatically be displayed on visualforce page.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
kmorf_entransformkmorf_entransform

 i got it. Thanks. that was way easier than i thought it would be