I am trying to insert values to the field in custom settings via visual force page
Page:
<apex:page controller="sample" sidebar="false" > <apex:form >
<apex:pageblock >
<apex:inputText value="{!myValueFromPage}"/>
<apex:commandButton action="{!sample}" value="Save Input"/>
</apex:pageblock> </apex:form> </apex:page>
Class:
public class sample
{
public String myValueFromPage{get; set;}
public void sample() {
User user = [Select Id from User where Name='warner'];
garage_app__saver__c settings = garage_app__saver__c.getInstance();
settings.name = myValueFromPage;
settings.SetupOwnerId=user.Id;
insert settings;
}
}
I am getting the following error
Error:
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: SetupOwnerId (id value of incorrect type): [SetupOwnerId]
I want to know where I am going wrong..Thanks in advance