• howard zien 24
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies

i have a sql server data table with 100 fields in it.
is there a way for me to import this data structure  and field description into SF as an object without having to navigate 100 screens, 1 for each field?
 
i am taking a visual force webcam. 
no errors are thrown, but changes I make to the nomination field are not saved.

controller code is
public with sharing class clscontroller {

   public List<contact> contacts {get;set;}

   public clscontroller(){
       contacts = [select id,name,email, phone , nominate__c from contact limit 10];
                         }
   public void save(){
        update contacts;
                     }
}

VF apex is
<apex:page showheader="false" controller="clscontroller">
<!--   to hide the entire salesforce nonsense, do the above with false   -->
<!--  <apex:page controller="clscontroller">    -->
      <apex:image value="{!$Resource.blogiclogo}" width="40%" height="40%"/>
      <apex:form >
      <apex:pageblock title="Nominate contacts">
         <apex:pageblockButtons >
            <apex:commandbutton value="save" action="{!save}" />
          </apex:pageblockButtons>
      <apex:pageblockTable value="{!contacts}" var="contact">
           <apex:column value="{!contact.name}"/>
           <apex:column headervalue="email">
                <apex:inputfield value="{!contact.email}" />
           </apex:column>
           <apex:column value="{!contact.phone}"/>
<!--             <apex:column value="{!contact.id}"/>  -->
           <apex:column headervalue="nominate" >
                <apex:inputfield value="{!contact.nominate__c}"/>
           </apex:column>
           
      
      </apex:pageblockTable>
     
  
      </apex:pageblock>   
       </apex:form>
</apex:page>



 
i made a custom object to test some logic I am trying to learn.  i could have used the standard object account, but wanted to isolate my changes in a custom object.

the custom object is hpzaccount.
there is a field in this table called name.
I made a 2nd field in the table called name_unique.

name_unique is a read only-field that does not permit dups.

whenever a new record is added or updated to hpzaccount,  the trigger sets
   name_unique__c = name;

the non-bulk version of this trigger works fine. It is
trigger create_unique_name on hpzaccount__c (before insert, before update) {
for (hpzaccount__c    hpza : Trigger.new){
  hpza.name_unique__c = hpza.name;
}
}

but i want to bulk up the trigger so that it works with dataloader.
I am getting a syntax error that I cannot figure out. can you help?

  
trigger create_unique_name on hpzaccount__c ( before insert, before update) {
    List< hpzaccount__c >  hpzlist  = new List< hpzaccount__c >{};
     //Loop through all records in the Trigger.new collection
   for(hpzaccount__c   hpza  :  Trigger.new){
        
      //Concatenate fields to list
        hpzlist.name = hpza.name;
       hpzlist.name_unique__c = hpza.name;
                                                             }
Insert hpzlist;
  }      








 
how can i enforce uniqueness on a standard field in a standar object.  like the name field in the account object

i know how to define uniqueness on a custom object and custom field.  But how do i do it on a standard object and field?
 
i am trying to loop thu an object 2 ways . the wrong way with a lop and the right way with a list.
neither one works.

the wrong way, with a loop looks like this.

// First get the new invoice statement
integer i = 0;
for (invoice_statement__c[] inv : [SELECT id FROM Invoice_Statement__c]);
     {
//WHERE Description__c='My new invoice'];
   system.debug(inv.id );
     }

i get this error message.
Line: 7, Column: 14
Variable does not exist: inv.id

i am too confused to write the syntax with a list. and could use some help.

 

i have a sql server data table with 100 fields in it.
is there a way for me to import this data structure  and field description into SF as an object without having to navigate 100 screens, 1 for each field?
 
i made a custom object to test some logic I am trying to learn.  i could have used the standard object account, but wanted to isolate my changes in a custom object.

the custom object is hpzaccount.
there is a field in this table called name.
I made a 2nd field in the table called name_unique.

name_unique is a read only-field that does not permit dups.

whenever a new record is added or updated to hpzaccount,  the trigger sets
   name_unique__c = name;

the non-bulk version of this trigger works fine. It is
trigger create_unique_name on hpzaccount__c (before insert, before update) {
for (hpzaccount__c    hpza : Trigger.new){
  hpza.name_unique__c = hpza.name;
}
}

but i want to bulk up the trigger so that it works with dataloader.
I am getting a syntax error that I cannot figure out. can you help?

  
trigger create_unique_name on hpzaccount__c ( before insert, before update) {
    List< hpzaccount__c >  hpzlist  = new List< hpzaccount__c >{};
     //Loop through all records in the Trigger.new collection
   for(hpzaccount__c   hpza  :  Trigger.new){
        
      //Concatenate fields to list
        hpzlist.name = hpza.name;
       hpzlist.name_unique__c = hpza.name;
                                                             }
Insert hpzlist;
  }      








 
how can i enforce uniqueness on a standard field in a standar object.  like the name field in the account object

i know how to define uniqueness on a custom object and custom field.  But how do i do it on a standard object and field?