• Anu-cnp
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 7
    Replies

Hi

 

I have a problem with page refreshing. I  want a configuration setting for the objects to update. I have created an object to maintain the record. I need only one record per user in that object.

 

For that I have written code in constructor so that each time a page is refreshing another record gets created.

 

Can any one of you modify my code and send back to me. I have to update only one record. No need of creating another record.

 

Page:

 

 


 

<apex:page controller="SettingsController">

 

 <apex:form id="form">  

 

        <apex:sectionHeader title="Object Settings" subtitle="Configure Settings">

 

            <description>

 

                Settings that control the behavior of the Donor Management package. Changing these will change how your Package behaves.
            </description>  
        </apex:sectionHeader>
        <apex:pageMessages id="pageMessages"/>
         <apex:pageBlock id="xmlsettings" title="XML Settings">
        <apex:pageBlockButtons >
             <apex:commandButton action="{!save}" Value="Update Settings"/>
         </apex:pageBlockButtons>
          <apex:pageBlockSection title="Contacts" >
                  <apex:inputField value="{!newSetting.Contacts__c}"  onClick="hideAccount(this)" />
             </apex:pageBlockSection>
  
             <apex:pageBlockSection title="Accounts">
                 <apex:inputField value="{!newSetting.Accounts__c}" />
             </apex:pageBlockSection>
     
            
             <apex:pageBlockSection title="Opportunities">
                 <apex:inputField value="{!newSetting.Opportunities__c}"/>
             </apex:pageBlockSection>
             <apex:pageBlockSection title="Households">
                  <apex:inputField value="{!newSetting.Households__c}"/>
             </apex:pageBlockSection>
        </apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

 

 

 

 

Controller:

 

 

 

 

 

 

 

public with sharing class SettingsController {


XML_Setting__c newSetting;

    

    public XML_Setting__c getnewSetting() {return newSetting;}

    public void setnewSetting(XML_Setting__c newSetting) {this.newSetting= newSetting; }



    public SettingsController() {

    Id id = ApexPages.currentPage().getParameters().get('id');

   newSetting = (id == null) ? new XML_Setting__c() : [Select Name,Contacts__c,Accounts__c,Opportunities__c,Households__c from XML_Setting__c where Id=:id ];


    }

     

    

    public PageReference Save()

    {

  

          

             

        

     

       upsert newSetting;


        return null;

    

    }


}

 

Hi,

 

I want to read xml from a custom object. My code is:

 

 

trigger dmldata on CnPData__c (before insert,after insert) {
    String dataxml;
  for(CnP__CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.CnP__DataXML__c;
  }
  XmlStreamReader reader= new XmlStreamReader(dataxml);
  Contact[] contacts = new Contact[0];
   while(reader.hasNext()) {
        if (reader.getEventType() == XmlTag.START_ELEMENT) {
             System.debug('local nameee'+reader.getLocalName());
             if ('Contact' == reader.getLocalName()) {
                  Contact con= parseContact(reader);
                  contacts.add(con);
                    System.debug('Contacts after parsinggg'+contacts);
              }
        }
         reader.next();
    }
Contact parseContact(XmlStreamReader reader1){
     Contact contact = new Contact();
  
     while(reader1.hasNext()) {
     System.debug('event typpeeee'+reader1.getEventType());
        if (reader1.getEventType() == XmlTag.END_ELEMENT){
           break;
        } 
        else if (reader1.getEventType() == XmlTag.CHARACTERS) {
        System.debug('Contacts getTextttt'+reader1.getText());
           contact.FirstName= reader1.getText();
           contact.LastName= reader1.getText();
         System.debug('Last Nameeeeee'+contact.LastName);
         }
         
        reader1.next();
        
     }
      return contact;
   }
}
My XML is:
<?xml version="1.0" encoding="UTF-8"?>
<Contact>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Contact>
I can able to get First name as John. But the loop is not going to 'Doe'.I want to pass that value into last name.
Can any one of you throw some help on this?

 

Hi

 

I've  a custom field in a custom object. I'm posting an xml file through external API. It is posted successfully. Now I want to map that data into Contact Object. I'm facing too many Script statements.

 

My code is:

 

 

trigger dmldata on CnPData__c (before insert,after insert) {
String dataxml;
    for(CnP__CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.CnP__DataXML__c;
    }
    System.debug('hiiiiiiiii'+dataxml);
    XmlStreamReader reader= new XmlStreamReader(dataxml);
    System.debug('reader valueeee'+reader);
    while(reader.hasNext()) {
    System.debug('reader event nameee'+reader.getEventType());
     /*if (reader.getEventType() == XmlTag.START_DOCUMENT) {
     System.debug('local nameee'+reader.getLocalName());
    
}*/
}
 
}
My sample xml in the field is :
<?xml version="1.0" encoding="utf-8"?>
<Contact>
 <FirstName>anu</FirstName>
    <LastName>rrr</LastName>  
 </Contact>
One more, If I debug the reader.getEventType() it is showing the Start_Document. I want this value as START_ELEMENT. how can I get that?
If it START_DOCUMENT how can I proceed with that to read the values.
Thanks a ton in advance.

 

Hi,

 

I've an xml file. I have to read data from XML and display on visualforce page and have to update some objects based on that data.

 

Can any one of you please help on this...

 

 

Thanks

Anu

Hi,

 

I have a package which is having several transactions.I have installed it in another account successfully.

 

I have created another package which is having households in it.households have all the data which has to be updated  based on transaction object results.

 

My aim is to have first package independant on household package. how can I do that?

 

I've a trial. I have installed the first pack successfully. and i created the middle object which is having both transaction and household lookups.When I want to update the first package households are automatically  added to first pack componants, which causes dependancy.

 

Can any one please help on this?

Hi,

 

Here is my code,

 

<apex:pageBlockSection title="Payment Method" columns="1">
<apex:pageblocksectionItem >
  <apex:outputlabel value="Payment is done through" for="compare" />

        <apex:selectList id="compare" value="{!compare}"  required="true"  size="1" >
        <apex:actionSupport event="onchange" reRender="newvalue" />
<apex:actionStatus startText="Processing...."/>
              <apex:selectOptions value="{!comparison}"  />
         </apex:selectList>
         </apex:pageblocksectionItem>

         <apex:outputPanel id="newvalue">

<apex:outputpanel rendered="{!compare=='Invoice'}" >
<div style="position:relative;left:75px;">   
<apex:outputlabel for="number" />
<b>Invoice Number:</b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number"/>
</div>
</apex:outputpanel>
<apex:outputpanel rendered="{!compare=='Cash'}" >
<div style="position:relative;left:75px;">   
<apex:outputlabel for="number2" />
<b>Receipt Number:</b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number2"/>
</div>
</apex:outputpanel>
<apex:outputpanel rendered="{!compare=='Purchase Order'}" >
<!--<div style="position:relative;left:75px;">  -->
<apex:outputlabel for="number3" />
<b>Purchase Order Number: </b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number3"/>
<!--</div>-->

</apex:outputpanel>
</apex:outputPanel>
 
       </apex:pageBlockSection> 

 

 

Apex Class:

 

public string compare{get;set;}

 

public List<SelectOption> getComparison()
{
System.debug('hii'+compare);
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Cash','Cash'));
options.add(new SelectOption('Invoice','Invoice'));
options.add(new SelectOption('Purchase Order','Purchase Order'));
return options;

}

 

 

My problem is I want to render the text field with label based on picklist values.I'm getting the compare value successfulyy. but I'm not able to rendered properly.

 

 

Any one can help me please.

 

 

Hi,

 

While installing the Chatter desktop into my system I hae found the following problem.

 

Sorry. an Error has occured.

 

The application could not be installed. Try installing it again. If the problem persists, contact the application author.

 

 

Can anyone of you let me know how can I solve this problem? Adobe air  version 2.5.1 is installed successfully into my system.

 

 

Thanks

Hi All,

 

I  have a problem with installing the packages. If the users want to install my package from appexchange, they need to install one more managed package before that.

 

If the users forgot this and tried to install my package and login to the application and follow the installation steps, finally they got the error messages like missing some packages into the system. 

 

I need this type of custom message while login to the user's credentials itself. Can I know how to do this.

 

 

Thanks in Advance.

 

Anuradha.

Hello Salesforce community,

 

I am still learning about salesforce so I hope I am posting it to the right board.

 

So, I was trying to update and install an app from AppExchange...  and I got an email notification from Salesforce regards to installation failure.  As I look at the problem, it has to do with "too many DML rows"

 

Here is a screen shot:

http://www.box.net/shared/4s95cmef9x

 

Would anybody able to help and guide me to install this app correctly?

 

Thanks,

 

Anthony Lee

Hi,

 

I want to read xml from a custom object. My code is:

 

 

trigger dmldata on CnPData__c (before insert,after insert) {
    String dataxml;
  for(CnP__CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.CnP__DataXML__c;
  }
  XmlStreamReader reader= new XmlStreamReader(dataxml);
  Contact[] contacts = new Contact[0];
   while(reader.hasNext()) {
        if (reader.getEventType() == XmlTag.START_ELEMENT) {
             System.debug('local nameee'+reader.getLocalName());
             if ('Contact' == reader.getLocalName()) {
                  Contact con= parseContact(reader);
                  contacts.add(con);
                    System.debug('Contacts after parsinggg'+contacts);
              }
        }
         reader.next();
    }
Contact parseContact(XmlStreamReader reader1){
     Contact contact = new Contact();
  
     while(reader1.hasNext()) {
     System.debug('event typpeeee'+reader1.getEventType());
        if (reader1.getEventType() == XmlTag.END_ELEMENT){
           break;
        } 
        else if (reader1.getEventType() == XmlTag.CHARACTERS) {
        System.debug('Contacts getTextttt'+reader1.getText());
           contact.FirstName= reader1.getText();
           contact.LastName= reader1.getText();
         System.debug('Last Nameeeeee'+contact.LastName);
         }
         
        reader1.next();
        
     }
      return contact;
   }
}
My XML is:
<?xml version="1.0" encoding="UTF-8"?>
<Contact>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Contact>
I can able to get First name as John. But the loop is not going to 'Doe'.I want to pass that value into last name.
Can any one of you throw some help on this?

 

Hi

 

I've  a custom field in a custom object. I'm posting an xml file through external API. It is posted successfully. Now I want to map that data into Contact Object. I'm facing too many Script statements.

 

My code is:

 

 

trigger dmldata on CnPData__c (before insert,after insert) {
String dataxml;
    for(CnP__CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.CnP__DataXML__c;
    }
    System.debug('hiiiiiiiii'+dataxml);
    XmlStreamReader reader= new XmlStreamReader(dataxml);
    System.debug('reader valueeee'+reader);
    while(reader.hasNext()) {
    System.debug('reader event nameee'+reader.getEventType());
     /*if (reader.getEventType() == XmlTag.START_DOCUMENT) {
     System.debug('local nameee'+reader.getLocalName());
    
}*/
}
 
}
My sample xml in the field is :
<?xml version="1.0" encoding="utf-8"?>
<Contact>
 <FirstName>anu</FirstName>
    <LastName>rrr</LastName>  
 </Contact>
One more, If I debug the reader.getEventType() it is showing the Start_Document. I want this value as START_ELEMENT. how can I get that?
If it START_DOCUMENT how can I proceed with that to read the values.
Thanks a ton in advance.

 

Hi,

 

I've an xml file. I have to read data from XML and display on visualforce page and have to update some objects based on that data.

 

Can any one of you please help on this...

 

 

Thanks

Anu

Hi All,

 

I  have a problem with installing the packages. If the users want to install my package from appexchange, they need to install one more managed package before that.

 

If the users forgot this and tried to install my package and login to the application and follow the installation steps, finally they got the error messages like missing some packages into the system. 

 

I need this type of custom message while login to the user's credentials itself. Can I know how to do this.

 

 

Thanks in Advance.

 

Anuradha.