• Aruna06
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 23
    Replies

Cant able to cover the test class for this code getting error saying that

 

 System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LastName]: [LastName]

my controller class is

 

public void AttendeeForm(){
//system.debug('check DynamicAttendeeForm'+DynamicAttendeeForm);
RadioChange();
system.debug('check lstResult' + lstResult);
for(AttendeeCustomFieldsClass a : lstResult){
system.debug('check Defaultvalue' + a.DefaultValue);
}
system.debug('check acc' + acc);
CreateContact(acc,'Attendee');
CreateAttendeeCustomFields(lstResult);
acc =new contact();

}

public void UpdateAttendee(){

update acc;
system.debug('check check'+ acc);
Map<string,string> NewAnswers=new Map<string,string>();
system.debug('check atte'+lstResult);
for(AttendeeCustomFieldsClass EA : lstResult){
NewAnswers.put(EA.FieldName,EA.DefaultValue);
}
list<Attendee_custom_information__c> NewCustomAnswers=[select Field_name__c,Field_value__c from Attendee_custom_information__c where Event_name__c=:eid and attendee_session_Id__r.ContactId__c=:EditAttendeeId];

for(Attendee_custom_information__c NA : NewCustomAnswers){
NA.Field_value__c=NewAnswers.get(NA.Field_name__c);
}
update NewCustomAnswers;
displayPopup = false;
}


string DeleteAttendeeId;
public string getDeleteAttendeeId(){return DeleteAttendeeId;}
public void setDeleteAttendeeId(string DeleteAttendeeId){this.DeleteAttendeeId=DeleteAttendeeId;}

public void DaleteAttendee(){
system.debug('check DeleteAttendeeId'+DeleteAttendeeId);
Event_attendee_session__c DelAtten=[select id from Event_attendee_session__c where id=:DeleteAttendeeId];
delete DelAtten;
}

 

My test class is

 

 

 EventRegistration eventreg = new EventRegistration();

Contact c = new contact(FirstName='aaa',LastName='bbb',Email='ccc@gmail.com',MailingCity='Hyderabad',MailingState='AP');
insert c;
ApexPages.currentPage().getParameters().put('id', c.id);

eventreg.AttendeeForm();
 eventreg.UpdateAttendee();
 eventreg.DaleteAttendee();

 

Hope somebody  would came across this and found a solution.....If yes let me know 

 

Any further information required I can give 

 

Thanks

  • September 05, 2012
  • Like
  • 0

Hello All,

 

  

<apex:page standardController="Account" >

<span class="st_sharethis" displayText="Share" st_url="http://sharethis.com" st_title="Sharing Rocks!"></span>

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
stLight.options({
publisher: '090ca7f1-3e25-46bf-94b7-0781ad6f1371',
popup: 'true'
});
</script>

</apex:page>

 

 

     I cant see the button in my Account when I edited in the page layout of account.........If I save it as Html it is working fine....What should I do to work in VF page also

Save error: SocialPost : Cannot create workflow directly; must create the CustomObject first SocialPost.workflow /Eventdev/src/workflows line 0 Force.com save problem

 

 

Getting error like this when trying to save to server by using eclipse.......How should I overcome with this......ANy ideas please

 

 

Hello All,

 

      public pagereference Save()
   {
          widgetpro = new C_P_Widgets__c();      
             for(integer i=0; i<selectlayout.size(); i++)  {  
               widgetpro.Widget_Category__c = Name1;
                widgetpro.Name =  Username ;
                   
                if(val != null)   {
                         val = val+  '<widget Image="' + selectlayout[i].Image1 + '" FieldLabel="' + selectlayout[i].label1 + '" result="' + selectlayout[i].result + '"/></widget>' ;    
                 }
                else {
                        val = '<widget Image="' + selectlayout[i].Image1 + '" FieldLabel="' + selectlayout[i].label1 + '" result="' + selectlayout[i].result + '"/></widget>' ;               
                     }
                  widgetpro.Displayed_Values__c = val;                       
           }                
              
           insert widgetpro;
           
             wid = widgetpro.id;  
         
         PageReference page =  new PageReference('/apex/widgetpageview?id='+wid);
           page.setRedirect(true);   
            return page;
  }

 

Here I'm saving the values and redirecting it to second vfpage and my vf page and controller class is

 

 <apex:pageblockSection title="Widget Details" collapsible="false" columns="1">
         <apex:pageblocktable value="{!widdata}" var="w">
       {!w.Name}    
           <apex:column value="{!w.Name}" headerValue="Widget Name"/>
           <apex:column value="{!w.Widget_Category__c}" headerValue="Category"/>
           <apex:column value="{!w.Displayed_Values__c}" headerValue="Result"/>
         </apex:pageblocktable>
       </apex:pageblockSection>

 

public class widgetpageview1 {
public string wid{set;get;}
 public widgetpageview1()
 {
 wid=apexpages.currentpage().getparameters().get('id');
 system.debug('!!!!!'+wid);
 
 }
  public list<C_P_Widgets__c>  widdata{set;get;}
           public list<C_P_Widgets__c> getwiddata()
           {         

              widdata = new  list<C_P_Widgets__c>();
           for(C_P_Widgets__c allwids : [select id, name, Displayed_Values__c, Widget_Category__c from C_P_Widgets__c where id=:wid limit 1])
           {           
           
           widdata.add(allwids);
            
           }
            system.debug('alllll' +widdata);
           return widdata;
            
           }
}

 

My problem is I can't see the saved values in this page.....Don't know why?please help

 

 

Hi all,

 

   I have a requirement of saving 5 values from inputtext into a single record......When I enter values in inputtext and click save, in debug log I can see that it is setting the values but unable to get those values......Can anyone help me in this issue, how can I get the values

 

                       <apex:repeat value="{!selectlayout}" var="layout" >                        
                        <apex:outputpanel layout="Block">                      
                             <apex:image value="{!layout.Image1}" height="30" width="30" />
                            
                            <apex:outputText value="{!layout.label1}" /> &nbsp; &nbsp; &nbsp;                          
                          
                            <apex:inputtext value="{!layout.layoutname}" rendered="{!layout.Text1='Textbox'}" size="25"/>                             <br/>
                            
                           <apex:inputtextarea rendered="{!layout.Text1='Textarea'}" /> <br/>
                 
                                             
                              </apex:outputpanel>                                                                       
                                                                                            
                    </apex:repeat>

               <apex:commandButton value="Save" action="{!Save}" />          

 

 

 

 

      public class FieldClass{
        public string label1{get;set;}
        public string Text1{get;set;}
         public string Image1{get;set;}
         public string layoutname{get;set;}  
      } 
 public void Save()
   {
    system.debug('Displayedvalueee'+layoutname);

}

      

   <apex:repeat value="{!selectlayout}" var="layout" >                        
                        <apex:outputpanel >                      
                             <apex:image value="{!layout.Image1}" height="30" width="30" />
                             <div>
                            <apex:outputText value="{!layout.label1}" />                          
                            <div>
                            <apex:inputtext value="{!layoutname}" rendered="{!layout.Text1='Textbox'}" size="40"/>
                           </div>
                           <apex:inputtextarea rendered="{!layout.Text1='Textarea'}" />
                           </div>
                                             
                              </apex:outputpanel>                                                                       
                                                                                            
                    </apex:repeat>

 

I'm getting inputtext down.....But I want that text to be aside....How can I get it

Hi,

 

   <script type="text/javascript">
    function NetWorkdata(field)
    {        
        calldisplayTemplate(field);
    }
</script>
 
  <apex:sectionHeader title="Page" subtitle="Displaying Widgets"/>
    <apex:form id="theform">
            <apex:actionFunction action="{!Networklist}" reRender="selectsection"  name="calldisplayTemplate" >
                <apex:param assignTo="{!Name1}" name="networkvalue" value=""/>         
            </apex:actionFunction>
       <apex:pageBlock >       
         <apex:pageBlockSection >
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Select Category"></apex:outputLabel>
                <apex:outputPanel >
                    <apex:repeat value="{!selectcategory}" var="social" id="selectcategory">
                        <td style="padding-left:10px;">
                            <div>
                            <apex:image value="{!social.Image}" height="110" width="110" onclick="NetWorkdata('{!social.Label}');"/>
                            <div>
                            <input type="radio" value="{!social.Label}" name="social" onclick="NetWorkdata('{!social.Label}');" />                          
                            {!social.Label}
                            </div>
                            </div>                                                               
                           </td>
                       </apex:repeat>
                   </apex:outputPanel>   
               </apex:pageBlockSectionItem>
            </apex:pageblocksection>
            <apex:outputPanel id="selectsection">
             <apex:pageblocksection >
                <apex:pageblocksectionItem >       
                <apex:outputlabel value="Displayed Widgets"/>
                </apex:pageblocksectionItem> <br/>
              <apex:pageblockSectionItem >              
                  <apex:outputlabel Value="WidgetName"></apex:outputlabel>
                 
                  <apex:inputtext value="{!Username}" size="40" styleclass="name"/>
        
                </apex:pageblockSectionItem>
                <br/>  
                <apex:pageBlockSectionItem >
                    <apex:repeat value="{!selectlayout}" var="layout" >
                          
                          
                               <apex:outputpanel >                      
                             <apex:image value="{!layout.Image1}" height="50" width="50" />
                             <div>
                            <apex:outputText value="{!layout.label1}" />
                          
                            <div>
                            <apex:inputtext value="{!layoutname}" rendered="{!layout.Text1='Textbox'}" size="40"/>
                             </div>
                           <apex:inputtextarea rendered="{!layout.Text1='Textarea'}" />
                           </div>
                               <br/>              
                              </apex:outputpanel>                                                                       
                                                                                            
                    </apex:repeat>
                </apex:pageBlockSectionItem>    

              </apex:pageblocksection>                  
                </apex:outputpanel>
                    <apex:commandButton value="Save" action="{!Save}" />                   
            </apex:pageblock>  
     </apex:form>

 

 

My requirement is that when I click on the first image.. I have to render the remaining images along with the username,Displyed Widgets and save button that I have wrote in vf page...........But what's happening now is I'm getting the first image plus these fields(save button,displayed widgets,&username)....when I click on the first Image only then this values should be render......how can this happen?

Hi all,

    I'm getting this error whenever I'm trying to save......After a research I came to know that  you cannot perform DML (insert, update, delete) prior to a callout ( http.send() )......I'm a newbie to the apex code......what should I do in my code to get rid of this.....Any help please

 

  public string main(string url)
    {
            Http h = new Http();    
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod('GET');
            req.setTimeout(60000);
            string result='';
            if(isValid==true)
            {
                HttpResponse res = h.send(req);
                result = res.getBody();
            }else{
                result = '<?xml version="1.0" encoding="ISO-8859-1"?><Widgets><BaseURL>http://click-pledge.v-empower.com/web/widgets/WidgetXml</BaseURL><Category FolderName="GoogleMaps" Name="GoogleMaps" Image="http://t2.gstatic.com/images?q=tbn:ANd9GcR2xHN7pAmAkALvFTvZkzbMzpqthnJIYGs9IRpPz9IlyMx8Zfu2Hl2QBeBe"><Widget Name="Facebook"><FieldLabel FieldType="Textbox" image="https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e">FacebookURL</FieldLabel></Widget></Image></Category></Widgets>';
                system.debug('------'+result);
            }           
            return result;
    }

 

public void Save()
   {
     widgetpro = new C_P_Widgets__c();
     system.debug('layoutnamename'+layoutname);
     widgetpro.Widget_type__c = layoutname;
     widgetpro.Widget_Category__c = Name1;   
      system.debug('Nammmmmme'+widgetpro.Widget_Category__c);  
      system.debug('Displayedvalueee'+layoutname);
      insert widgetpro;
 }       

 

Hi,

 

   I have changed a little bit code from xmlstreamreaderdemo which I got from google.It is not returning the value when i changed the code can anyone help me in this issue

 

here is the code that I got from google

public class XmlStreamReaderDemo {

// Create a class Book for processing      

  public class Book {   

   String name;     

   String author;   

 }

   Book[] parseBooks(XmlStreamReader reader) {  

    Book[] books = new Book[0];

     while(reader.hasNext()) {

//  Start at the beginning of the book and make sure that it is a book        

      if (reader.getEventType() == XmlTag.START_ELEMENT) {       

      if ('Book' == reader.getLocalName()) {

//  Pass the book to the parseBook method (below)                 

     Book book = parseBook(reader);               

  books.add(book);         

    }      

    }    

     reader.next();

     }  

   return books;

   }

// Parse through the XML, deterimine the auther and the characters      

  Book parseBook(XmlStreamReader reader) {    

  Book book = new Book();     

 book.author = reader.getAttributeValue(null, 'author');     

while(reader.hasNext()) {        

 if (reader.getEventType() == XmlTag.END_ELEMENT) {         

   break;        

}

 else if (reader.getEventType() == XmlTag.CHARACTERS) {          

  book.name = reader.getText();   

      }        

 reader.next();     

}     

 return book;

   }

// Test that the XML string contains specific values

        static testMethod void testBookParser() {

     XmlStreamReaderDemo demo = new XmlStreamReaderDemo();

     String str = '<books><book author="Chatty">Foo bar</book>' + '<book author="Sassy">Baz</book></books>';

     XmlStreamReader reader = new XmlStreamReader(str);     

Book[] books = demo.parseBooks(reader);

     System.debug(books.size());

     for (Book book : books) {    

    System.debug(book);  

    }   

 }

}

 

 

and the code which i edited is

 

public class XmlStreamDemo {

     public string link{get;set;}  

  public string socialnetwork{get;set;}   

    public class Network{     

String name;     

 String field;

   }

   Network[] parseNetworks(XmlStreamReader reader) {     

Network[] socialnetwork= new Network[0];     

 while(reader.hasNext()) {        

  if (reader.getEventType() == XmlTag.START_ELEMENT) {           

  if ('Network' == reader.getLocalName()) {

               Network link = parseNetwork(reader);            

     socialnetwork.add(link);            

 }        

  }       

  reader.next();     

}    

return socialnetwork;  

  }   

 Network parseNetwork(XmlStreamReader reader) {   

   Network link = new Network();    

  link.field= reader.getAttributeValue(null, 'Image');   

   while(reader.hasNext()) {     

    if (reader.getEventType() == XmlTag.END_ELEMENT) {       

     break;        

 }

else if (reader.getEventType() == XmlTag.CHARACTERS) {     

       link.name = reader.getText();       

  }      

   reader.next();     

 }     

return link;  

}  

Public void refer() {

     XmlStreamDemo demo = new XmlStreamDemo();

     String str = '<socialnetwork><link Image="Chatty">Aruna</link>' +  '<link Image="Sassy">Baz</link></socialnetwork>';     

   XmlStreamReader reader = new XmlStreamReader(str);       

   Network[] socialnetwork= demo.parseNetworks(reader);

     System.debug('======'+socialnetwork.size());

  // System.debug('==========='+socialnetwork);    

  for (Network link:socialnetwork) {  

      System.debug('-------'+link);     

}  

  }

}

 

whenever I paste the first code I'm getting the values in system.debug.....but when i tried my own code it's returning the size as '0'.can anyone help me in this issue

Hi,

  My requirement is whenever I clicked on a image in a vf page appropriate values should be displayed in th e same vf page.Now i can get the image in a vf page but When I clicked the image its doing nothing....can anyone explain me how should i acheive this.........any reply would be sincerely appreciated

 

Thanks in advance,

 

Hi all,

  I'm having a requirement of whenever I click a image that is displayed by performing an action,the values in xml file (here is facebook label)should display in a vf page..here is my code

 

public class XmlStreamReaderDemo2 {

     public string url{set;get;}  

   public PageReference ImageUrl()     {    

String str = '<socialnetwork><Image><Fieldlabel>FaceBook Url</Fieldlabel></socialnetwork>';      

//  Id id;         System.debug('urlllllllllllllll'+url);     

     PageReference p = new PageReference('?id='+str);      

  //   id=apexpages.currentpage().getparameters().get('image1.field');      

    return p;                 

     }     

public String image1 { get; set; }   

public string ImageUrl{get;set;}     

  public class Network    {     

String name;     

String field;  

   }

   Network[] parsesocialnetwork(XmlStreamReader reader) {     

 Network[] socialnetwork= new Network[0];   

 while(reader.hasNext()) {

         if (reader.getEventType() == XmlTag.START_ELEMENT) {        

     if ('Network' == reader.getLocalName()) {

                Network image1= parseImages(reader);               

  socialnetwork.add(image1);                           

  }        

  }    

     reader.next();    

  }

    return socialnetwork;  

  }

   Network parseImages(XmlStreamReader reader) {     

 Network image1= new Network();      

while(reader.hasNext())   {   

if (reader.getEventType() == XmlTag.START_ELEMENT)  {  

   if (reader.getLocalName() == 'Image')     {    

   reader.next();   

  if (reader.getEventType() == XmlTag.characters)      {    

     image1.name= reader.getText();  

   }   

}    

   if (reader.getLocalName() == 'Fieldlabel')    {   

 reader.next();  

 if (reader.getEventType() == XmlTag.characters)    {  

  image1.field= reader.getText();  

}  

 }

  }  

 reader.next();

 }  

  return image1;         

   }    

public void action()   {  

  XmlStreamReaderDemo2 demo = new XmlStreamReaderDemo2();     

  String str = '<socialnetwork><Image>https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e</Image><Fieldlabel>FaceBook Url</Fieldlabel></socialnetwork>';       

 XmlStreamReader reader = new XmlStreamReader(str);    

  Network socialnetwork = demo.parseImages(reader);  

    System.debug('---------'+socialnetwork);     

 System.debug('---------'+ImageUrl);      // System.debug(socialnetwork.size());    

   ImageUrl=string.valueof(socialnetwork.name);    

 // url = string.valueOf(socialnetwork.field);         

 }             

}

 

 

and my vf page is

 

<apex:page controller="XmlStreamReaderDemo2">

   <Apex:form >    

<apex:pageBlock >     

  <apex:commandButton value="Refer" action="{!Action}" reRender="ImageDisplay"/>

      <apex:pageBlockSection >    

   <apex:outputPanel id="ImageDisplay">        

 <apex:image value="{!ImageUrl}"  >       

<apex:actionSupport event="onclick" action="{!ImageUrl}"/>         

  </apex:image>      

  <!-- <apex:inputtext value="{!url}" size="40"/> -->     

   </apex:outputPanel>      

</apex:pageBlockSection>     

      </apex:pageBlock>  

 </Apex:form>

 </apex:page>

 

Any help would be sincerely appreciated

 

Thanks in advance,

 

Hi all,

  My vf page and class is as below

 

<apex:page controller="XmlStreamDemo">
  <apex:form >
   <apex:commandButton value="Refer" action="{!refer}"/>  
   <apex:outputText value="{!socialnetwork}"></apex:outputText>   
  </apex:form>
</apex:page>

 

-----------------------------------------------------------------------------------------

 

public class XmlStreamDemo {
    public string link{get;set;}
    public String socialnetwork { get; set; }
   public class Network{
     String name;
     String Image;
   }

   Network[] parseNetworks(XmlStreamReader reader) {
     Network[] socialnetwork = new Network[0];
     while(reader.hasNext()) {
         if (reader.getEventType() == XmlTag.START_ELEMENT) {
            if ('Network' == reader.getLocalName()) {

               Network link = parseNetwork(reader);
                socialnetwork.add(link);
            }
         }
        reader.next();
     }
    return socialnetwork;
   }
   Network parseNetwork(XmlStreamReader reader) {
     Network link = new Network();
     link.Image = reader.getAttributeValue(null, 'Image');
     while(reader.hasNext()) {
        if (reader.getEventType() == XmlTag.END_ELEMENT) {
           break;
        } else if (reader.getEventType() == XmlTag.CHARACTERS) {
           link.name = reader.getText();
        }
        reader.next();
     }
     return link;
  }
  Public void refer() {

     XmlStreamDemo demo = new XmlStreamDemo();

     String str = '<socialnetwork><link Image="Chatty">Aruna</link>' +
        '<link Image="Sassy">Baz</link></socialnetwork>';
 
     XmlStreamReader reader2 = new XmlStreamReader(str);
    
     Network[] socialnetwork= demo.parseNetworks(reader2);

     System.debug('======'+socialnetwork.size());
  // System.debug('==========='+socialnetwork);
     for (Network Image:socialnetwork1 ) {
       System.debug('-------'+Image);
     }
   }
}

 

 here the problem is Im unable to get the values in outputtext and whenever Im checking in debug it's showing the size as 0......Any reply would be greatly appreciated

 

Thanks in advance

Hi,

   I have created an object say widget and in that object I have created two fields

1.)Name

2.)iframe:Into this iframe I'll paste the code of a widget(for ex:<script type="text/javascript" src="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js"></script><script type="text/javascript">if (WIDGETBOX) WIDGETBOX.renderWidget('e0e820ae-5ea6-4688-b15d-b833c87f96e6');</script> 

<noscript>Get the <a href="http://www.widgetbox.com/widget/farm-frenzy-games">Farm Frenzy Games</a> widget and many other <a href="http://www.widgetbox.com/">great free widgets</a> at <a href="http://www.widgetbox.com">Widgetbox</a>! Not seeing a widget? (<a href="http://support.widgetbox.com/">More info</a>)</noscript>

    Now my requirement is to get this iframe code into visualforce dynamically by using <apex:iframe> so that I can display my widget as I required.For this my code is as below

 

<apex:page standardcontroller="Widgetbox__c" extensions="widgetboxdetail" sidebar="false">
<apex:form >
<apex:pageBlock title="Widget Details">
<apex:pageBlockTable value="{!widgetboxDetail}" var="widgets">
<apex:column value="{!widgets.name}" headerValue="Name"/>
<apex:column value="{!widgets.iframe__c}" headerValue="iFrame Value"/>
 </apex:pageBlockTable>
 <apex:iframe src="{!iframe}" scrolling="true" height="920"/>
</apex:pageBlock>
 </apex:form>
</apex:page>

 

 

and the class for this is

 

public class widgetboxdetail
{
public Widgetbox__c widgetList{get;set;}
public string iframe {get;set;}
public widgetboxdetail(ApexPages.StandardController controller)
{
}
public Widgetbox__c getwidgetboxdetail()
{

widgetList = [select id,Name,iframe__c from Widgetbox__c where Name='Aruna'];
system.debug('name-------'+widgetlist.Name);
system.debug('iframe-------'+widgetList.iframe__c);
iframe =widgetList.iframe__c;
return widgetList;
 }
}

 

so whenever Im saving this program I'm getting an error saying that:URL No Longer Exists

can anyone pls help me in this issue......

 

Thanks in advance

Hi,

 

  I have seen some people adding jquery in visualforce page in their project.Whenever I see that code I can understand the visualforce page code starting from <apex:page> to the end except the Jquery which was written before the visualforce page.I'm very new to Jqueries.Can anyone explain me about Jquery and its necessity.

 

Thanks in advance

Aruna V

Cant able to cover the test class for this code getting error saying that

 

 System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LastName]: [LastName]

my controller class is

 

public void AttendeeForm(){
//system.debug('check DynamicAttendeeForm'+DynamicAttendeeForm);
RadioChange();
system.debug('check lstResult' + lstResult);
for(AttendeeCustomFieldsClass a : lstResult){
system.debug('check Defaultvalue' + a.DefaultValue);
}
system.debug('check acc' + acc);
CreateContact(acc,'Attendee');
CreateAttendeeCustomFields(lstResult);
acc =new contact();

}

public void UpdateAttendee(){

update acc;
system.debug('check check'+ acc);
Map<string,string> NewAnswers=new Map<string,string>();
system.debug('check atte'+lstResult);
for(AttendeeCustomFieldsClass EA : lstResult){
NewAnswers.put(EA.FieldName,EA.DefaultValue);
}
list<Attendee_custom_information__c> NewCustomAnswers=[select Field_name__c,Field_value__c from Attendee_custom_information__c where Event_name__c=:eid and attendee_session_Id__r.ContactId__c=:EditAttendeeId];

for(Attendee_custom_information__c NA : NewCustomAnswers){
NA.Field_value__c=NewAnswers.get(NA.Field_name__c);
}
update NewCustomAnswers;
displayPopup = false;
}


string DeleteAttendeeId;
public string getDeleteAttendeeId(){return DeleteAttendeeId;}
public void setDeleteAttendeeId(string DeleteAttendeeId){this.DeleteAttendeeId=DeleteAttendeeId;}

public void DaleteAttendee(){
system.debug('check DeleteAttendeeId'+DeleteAttendeeId);
Event_attendee_session__c DelAtten=[select id from Event_attendee_session__c where id=:DeleteAttendeeId];
delete DelAtten;
}

 

My test class is

 

 

 EventRegistration eventreg = new EventRegistration();

Contact c = new contact(FirstName='aaa',LastName='bbb',Email='ccc@gmail.com',MailingCity='Hyderabad',MailingState='AP');
insert c;
ApexPages.currentPage().getParameters().put('id', c.id);

eventreg.AttendeeForm();
 eventreg.UpdateAttendee();
 eventreg.DaleteAttendee();

 

Hope somebody  would came across this and found a solution.....If yes let me know 

 

Any further information required I can give 

 

Thanks

  • September 05, 2012
  • Like
  • 0

Hello All,

 

  

<apex:page standardController="Account" >

<span class="st_sharethis" displayText="Share" st_url="http://sharethis.com" st_title="Sharing Rocks!"></span>

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
stLight.options({
publisher: '090ca7f1-3e25-46bf-94b7-0781ad6f1371',
popup: 'true'
});
</script>

</apex:page>

 

 

     I cant see the button in my Account when I edited in the page layout of account.........If I save it as Html it is working fine....What should I do to work in VF page also

Save error: SocialPost : Cannot create workflow directly; must create the CustomObject first SocialPost.workflow /Eventdev/src/workflows line 0 Force.com save problem

 

 

Getting error like this when trying to save to server by using eclipse.......How should I overcome with this......ANy ideas please

 

 

Hello All,

 

      public pagereference Save()
   {
          widgetpro = new C_P_Widgets__c();      
             for(integer i=0; i<selectlayout.size(); i++)  {  
               widgetpro.Widget_Category__c = Name1;
                widgetpro.Name =  Username ;
                   
                if(val != null)   {
                         val = val+  '<widget Image="' + selectlayout[i].Image1 + '" FieldLabel="' + selectlayout[i].label1 + '" result="' + selectlayout[i].result + '"/></widget>' ;    
                 }
                else {
                        val = '<widget Image="' + selectlayout[i].Image1 + '" FieldLabel="' + selectlayout[i].label1 + '" result="' + selectlayout[i].result + '"/></widget>' ;               
                     }
                  widgetpro.Displayed_Values__c = val;                       
           }                
              
           insert widgetpro;
           
             wid = widgetpro.id;  
         
         PageReference page =  new PageReference('/apex/widgetpageview?id='+wid);
           page.setRedirect(true);   
            return page;
  }

 

Here I'm saving the values and redirecting it to second vfpage and my vf page and controller class is

 

 <apex:pageblockSection title="Widget Details" collapsible="false" columns="1">
         <apex:pageblocktable value="{!widdata}" var="w">
       {!w.Name}    
           <apex:column value="{!w.Name}" headerValue="Widget Name"/>
           <apex:column value="{!w.Widget_Category__c}" headerValue="Category"/>
           <apex:column value="{!w.Displayed_Values__c}" headerValue="Result"/>
         </apex:pageblocktable>
       </apex:pageblockSection>

 

public class widgetpageview1 {
public string wid{set;get;}
 public widgetpageview1()
 {
 wid=apexpages.currentpage().getparameters().get('id');
 system.debug('!!!!!'+wid);
 
 }
  public list<C_P_Widgets__c>  widdata{set;get;}
           public list<C_P_Widgets__c> getwiddata()
           {         

              widdata = new  list<C_P_Widgets__c>();
           for(C_P_Widgets__c allwids : [select id, name, Displayed_Values__c, Widget_Category__c from C_P_Widgets__c where id=:wid limit 1])
           {           
           
           widdata.add(allwids);
            
           }
            system.debug('alllll' +widdata);
           return widdata;
            
           }
}

 

My problem is I can't see the saved values in this page.....Don't know why?please help

 

 

Hi all,

 

   I have a requirement of saving 5 values from inputtext into a single record......When I enter values in inputtext and click save, in debug log I can see that it is setting the values but unable to get those values......Can anyone help me in this issue, how can I get the values

 

                       <apex:repeat value="{!selectlayout}" var="layout" >                        
                        <apex:outputpanel layout="Block">                      
                             <apex:image value="{!layout.Image1}" height="30" width="30" />
                            
                            <apex:outputText value="{!layout.label1}" /> &nbsp; &nbsp; &nbsp;                          
                          
                            <apex:inputtext value="{!layout.layoutname}" rendered="{!layout.Text1='Textbox'}" size="25"/>                             <br/>
                            
                           <apex:inputtextarea rendered="{!layout.Text1='Textarea'}" /> <br/>
                 
                                             
                              </apex:outputpanel>                                                                       
                                                                                            
                    </apex:repeat>

               <apex:commandButton value="Save" action="{!Save}" />          

 

 

 

 

      public class FieldClass{
        public string label1{get;set;}
        public string Text1{get;set;}
         public string Image1{get;set;}
         public string layoutname{get;set;}  
      } 
 public void Save()
   {
    system.debug('Displayedvalueee'+layoutname);

}

      

   <apex:repeat value="{!selectlayout}" var="layout" >                        
                        <apex:outputpanel >                      
                             <apex:image value="{!layout.Image1}" height="30" width="30" />
                             <div>
                            <apex:outputText value="{!layout.label1}" />                          
                            <div>
                            <apex:inputtext value="{!layoutname}" rendered="{!layout.Text1='Textbox'}" size="40"/>
                           </div>
                           <apex:inputtextarea rendered="{!layout.Text1='Textarea'}" />
                           </div>
                                             
                              </apex:outputpanel>                                                                       
                                                                                            
                    </apex:repeat>

 

I'm getting inputtext down.....But I want that text to be aside....How can I get it

Hi,

 

   I have changed a little bit code from xmlstreamreaderdemo which I got from google.It is not returning the value when i changed the code can anyone help me in this issue

 

here is the code that I got from google

public class XmlStreamReaderDemo {

// Create a class Book for processing      

  public class Book {   

   String name;     

   String author;   

 }

   Book[] parseBooks(XmlStreamReader reader) {  

    Book[] books = new Book[0];

     while(reader.hasNext()) {

//  Start at the beginning of the book and make sure that it is a book        

      if (reader.getEventType() == XmlTag.START_ELEMENT) {       

      if ('Book' == reader.getLocalName()) {

//  Pass the book to the parseBook method (below)                 

     Book book = parseBook(reader);               

  books.add(book);         

    }      

    }    

     reader.next();

     }  

   return books;

   }

// Parse through the XML, deterimine the auther and the characters      

  Book parseBook(XmlStreamReader reader) {    

  Book book = new Book();     

 book.author = reader.getAttributeValue(null, 'author');     

while(reader.hasNext()) {        

 if (reader.getEventType() == XmlTag.END_ELEMENT) {         

   break;        

}

 else if (reader.getEventType() == XmlTag.CHARACTERS) {          

  book.name = reader.getText();   

      }        

 reader.next();     

}     

 return book;

   }

// Test that the XML string contains specific values

        static testMethod void testBookParser() {

     XmlStreamReaderDemo demo = new XmlStreamReaderDemo();

     String str = '<books><book author="Chatty">Foo bar</book>' + '<book author="Sassy">Baz</book></books>';

     XmlStreamReader reader = new XmlStreamReader(str);     

Book[] books = demo.parseBooks(reader);

     System.debug(books.size());

     for (Book book : books) {    

    System.debug(book);  

    }   

 }

}

 

 

and the code which i edited is

 

public class XmlStreamDemo {

     public string link{get;set;}  

  public string socialnetwork{get;set;}   

    public class Network{     

String name;     

 String field;

   }

   Network[] parseNetworks(XmlStreamReader reader) {     

Network[] socialnetwork= new Network[0];     

 while(reader.hasNext()) {        

  if (reader.getEventType() == XmlTag.START_ELEMENT) {           

  if ('Network' == reader.getLocalName()) {

               Network link = parseNetwork(reader);            

     socialnetwork.add(link);            

 }        

  }       

  reader.next();     

}    

return socialnetwork;  

  }   

 Network parseNetwork(XmlStreamReader reader) {   

   Network link = new Network();    

  link.field= reader.getAttributeValue(null, 'Image');   

   while(reader.hasNext()) {     

    if (reader.getEventType() == XmlTag.END_ELEMENT) {       

     break;        

 }

else if (reader.getEventType() == XmlTag.CHARACTERS) {     

       link.name = reader.getText();       

  }      

   reader.next();     

 }     

return link;  

}  

Public void refer() {

     XmlStreamDemo demo = new XmlStreamDemo();

     String str = '<socialnetwork><link Image="Chatty">Aruna</link>' +  '<link Image="Sassy">Baz</link></socialnetwork>';     

   XmlStreamReader reader = new XmlStreamReader(str);       

   Network[] socialnetwork= demo.parseNetworks(reader);

     System.debug('======'+socialnetwork.size());

  // System.debug('==========='+socialnetwork);    

  for (Network link:socialnetwork) {  

      System.debug('-------'+link);     

}  

  }

}

 

whenever I paste the first code I'm getting the values in system.debug.....but when i tried my own code it's returning the size as '0'.can anyone help me in this issue

Hi,

  My requirement is whenever I clicked on a image in a vf page appropriate values should be displayed in th e same vf page.Now i can get the image in a vf page but When I clicked the image its doing nothing....can anyone explain me how should i acheive this.........any reply would be sincerely appreciated

 

Thanks in advance,

 

Is there a way to track the history of a custom object?

Hi all,

  My vf page and class is as below

 

<apex:page controller="XmlStreamDemo">
  <apex:form >
   <apex:commandButton value="Refer" action="{!refer}"/>  
   <apex:outputText value="{!socialnetwork}"></apex:outputText>   
  </apex:form>
</apex:page>

 

-----------------------------------------------------------------------------------------

 

public class XmlStreamDemo {
    public string link{get;set;}
    public String socialnetwork { get; set; }
   public class Network{
     String name;
     String Image;
   }

   Network[] parseNetworks(XmlStreamReader reader) {
     Network[] socialnetwork = new Network[0];
     while(reader.hasNext()) {
         if (reader.getEventType() == XmlTag.START_ELEMENT) {
            if ('Network' == reader.getLocalName()) {

               Network link = parseNetwork(reader);
                socialnetwork.add(link);
            }
         }
        reader.next();
     }
    return socialnetwork;
   }
   Network parseNetwork(XmlStreamReader reader) {
     Network link = new Network();
     link.Image = reader.getAttributeValue(null, 'Image');
     while(reader.hasNext()) {
        if (reader.getEventType() == XmlTag.END_ELEMENT) {
           break;
        } else if (reader.getEventType() == XmlTag.CHARACTERS) {
           link.name = reader.getText();
        }
        reader.next();
     }
     return link;
  }
  Public void refer() {

     XmlStreamDemo demo = new XmlStreamDemo();

     String str = '<socialnetwork><link Image="Chatty">Aruna</link>' +
        '<link Image="Sassy">Baz</link></socialnetwork>';
 
     XmlStreamReader reader2 = new XmlStreamReader(str);
    
     Network[] socialnetwork= demo.parseNetworks(reader2);

     System.debug('======'+socialnetwork.size());
  // System.debug('==========='+socialnetwork);
     for (Network Image:socialnetwork1 ) {
       System.debug('-------'+Image);
     }
   }
}

 

 here the problem is Im unable to get the values in outputtext and whenever Im checking in debug it's showing the size as 0......Any reply would be greatly appreciated

 

Thanks in advance

Hi,

   I have created an object say widget and in that object I have created two fields

1.)Name

2.)iframe:Into this iframe I'll paste the code of a widget(for ex:<script type="text/javascript" src="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js"></script><script type="text/javascript">if (WIDGETBOX) WIDGETBOX.renderWidget('e0e820ae-5ea6-4688-b15d-b833c87f96e6');</script> 

<noscript>Get the <a href="http://www.widgetbox.com/widget/farm-frenzy-games">Farm Frenzy Games</a> widget and many other <a href="http://www.widgetbox.com/">great free widgets</a> at <a href="http://www.widgetbox.com">Widgetbox</a>! Not seeing a widget? (<a href="http://support.widgetbox.com/">More info</a>)</noscript>

    Now my requirement is to get this iframe code into visualforce dynamically by using <apex:iframe> so that I can display my widget as I required.For this my code is as below

 

<apex:page standardcontroller="Widgetbox__c" extensions="widgetboxdetail" sidebar="false">
<apex:form >
<apex:pageBlock title="Widget Details">
<apex:pageBlockTable value="{!widgetboxDetail}" var="widgets">
<apex:column value="{!widgets.name}" headerValue="Name"/>
<apex:column value="{!widgets.iframe__c}" headerValue="iFrame Value"/>
 </apex:pageBlockTable>
 <apex:iframe src="{!iframe}" scrolling="true" height="920"/>
</apex:pageBlock>
 </apex:form>
</apex:page>

 

 

and the class for this is

 

public class widgetboxdetail
{
public Widgetbox__c widgetList{get;set;}
public string iframe {get;set;}
public widgetboxdetail(ApexPages.StandardController controller)
{
}
public Widgetbox__c getwidgetboxdetail()
{

widgetList = [select id,Name,iframe__c from Widgetbox__c where Name='Aruna'];
system.debug('name-------'+widgetlist.Name);
system.debug('iframe-------'+widgetList.iframe__c);
iframe =widgetList.iframe__c;
return widgetList;
 }
}

 

so whenever Im saving this program I'm getting an error saying that:URL No Longer Exists

can anyone pls help me in this issue......

 

Thanks in advance

I'm trying to use a call to apex:iframe as below (this isn't the exact code but same situation)

 

<apex:iframe src="{!IFrameLink}" scrolling="false" frameborder="false" width="810" height="620"/>
 

and here is what my function looks like

    public String getIFrameLink() {
        if (searchString != null)
            return 'http://www.google.ca/search?hl=en&q='+searchString;
        else
            return 'javascript:void();';
    }

 

When I view source in IE7 the iframe is constructed like

<iframe src="http://www.google.ca/search?hl=en&amp;q=query+string" scrolling="false" frameborder="false" width="810" height="620"/>

 

This doesn't work because of the &amp; in the link.  Any suggestions on how to resolve this? I'd still like to have a blank iframe if the test value is empty

Hi all,

I am new for Apex development. So please help me out. Any help will be appreciable.
Currently I am using a function in our application in which I am retrieving data from external web services and storing it in Salesforce database. I am calling this function in a ‘for’ loop because this is getting called multiple times based on the selection of checkboxes. At 1st time, this function is working properly but 2nd time, It's giving exception which is as follows:
ERROR: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

Below is the function which is getting called multiple times:
WebService static void getContent(String id)
{
    String response = '';
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    String url = 'url of the web service';
    req.setEndpoint(url);
    req.setMethod('GET');
    HttpResponse res=null;
    try {
        res= h.send(req);
    } catch(System.CalloutException e) {
    System.debug('ERROR: '+ e);
}

Thanks,
Manjiri