function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
abi dzarabi dzar 

Custom Object insert in Visualforce.

Hi guys, I really needs help, I want to add the data to my custom object. but, it does not work? I search the answer all over the community. Can anyone help me? I tried using Account as standard controller and it works and when I try my own custom object, it does not work. Do I missed something here?

 

 

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_name__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c}"/>                    
    </apex:form>            
</apex:page>

 

 

Regards,

Abi Dzar

Best Answer chosen by Admin (Salesforce Developers) 
SSRS2SSRS2

Hello Abi Dzar.

 If you have create custom object it automatically create a required field called 'Name'. Therefore you have to add that field also

Change your code with Name field.

 

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Name}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_name__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c}"/>                    
    </apex:form>            
</apex:page>

-Suresh

 

All Answers

SSRS2SSRS2

Hello Abi Dzar.

 If you have create custom object it automatically create a required field called 'Name'. Therefore you have to add that field also

Change your code with Name field.

 

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Name}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_name__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c}"/>                    
    </apex:form>            
</apex:page>

-Suresh

 

This was selected as the best answer
b-Forceb-Force

Guys ,

Try this code also

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Name}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_n​ame__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c​}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c​}"/>                    
<apex:commandButton action="{!save}" value="Save record"/>
<apex:commandButton action="Cancel" value="Cancel"/>
    </apex:form>            
</apex:page>

 

Hope this will help you

 

Thanks,

Bala

abi dzarabi dzar

Thanks a lot Suresh, It works!.

How if I dont want to let user add the name of the record? Can the name be hidden value?

 

One additional question,  where usually people use to store settings variable for an application? in documents? custom settings or custom objects? which the settings have sensitive information like usename and password of something. 

 

 

Regards,

Abi Dzar

SSRS2SSRS2

>Can the name be hidden value? I think cannot hidden but you can use this filed for any of your custom field (Use name field for your Community_name__c field)

 

> Where usually people use to store settings variable for an application? I think better to use custom object and if you use password then do encode value before save.

-Suresh

 

abi dzarabi dzar

Thanks again Suresh.

 

regards,

Abi Dzar

naypersnaypers

I did this and it doesn't work on a website ...

 

<apex:page standardController="Merchandise__c"  >
    <apex:form >
       <apex:inputField value="{!Merchandise__c.Name}" />
       <apex:inputField value="{!Merchandise__c.Description__c}" />
       <apex:inputField value="{!Merchandise__c.Total_Inventory__c}"/>
       <apex:commandButton action="{!save}" value="Save record"/>
       <apex:commandButton action="Cancel" value="Cancel"/>
    </apex:form>           
</apex:page>

 

What could be happening?, it doesn't record anything, and It has the custom object permissions of Merchandise__c

What I should consider to public this on a website?

 

Regards,

naypers.

Save CommunitySave Community

Hi,

 

I tried the code that you have given but it doesn't work. I am unable to save my custom object records. I have taken required filed as Auto number..Is that's the problem ?

 

Thank you, 

Anil


b-Force wrote:

Guys ,

Try this code also

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Name}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_n​ame__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c​}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c​}"/>                    
<apex:commandButton action="{!save}" value="Save record"/>
<apex:commandButton action="Cancel" value="Cancel"/>
    </apex:form>            
</apex:page>

 

Hope this will help you

 

Thanks,

Bala



b-Force wrote:

Guys ,

Try this code also

<apex:page standardController="GetSatisfaction_Properties__c"  >
    <apex:form >
        <apex:inputField value="{!GetSatisfaction_Properties__c.Name}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Community_n​ame__c}" />
        <apex:inputField value="{!GetSatisfaction_Properties__c.Username__c​}"/>
        <apex:inputField value="{!GetSatisfaction_Properties__c.Password__c​}"/>                    
<apex:commandButton action="{!save}" value="Save record"/>
<apex:commandButton action="Cancel" value="Cancel"/>
    </apex:form>            
</apex:page>

 

Hope this will help you

 

Thanks,

Bala




.