• vviyer
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I have three projects in IDE. ONE of them doesn't save to server automatically. I have to, each time do

Project-> right click->force.com->save to server. then see what the errors. are. Its painful. THe other projects work fine. And yes, the 'Buil Automatically" under 'Project' is checked. Please help.

  • April 10, 2009
  • Like
  • 0

I'm learning to write apex code for calling out to external webservices. I started out with strikeIrons zipcode lookup. I'm new to webservices, so please help me out. Is this how I should go abt doing it?

1. Get WSDL. Generate apex.(done)

2. Created county__c field in account sObject(done)

3. Write before insert, before update trigger that passes the zipcode to CountyLookupClass.(done)

4. CountyLookupClass calls the @future webservice, passes the authentication parameters(username,password) and also the zipcode. 

5. StrikeIron authenticates. Returns county. 

6. Need to map the returned county name to Account.County__c field, so that it is added/inserted to the force.com database. 

 

Am I right? Here is the trigger

 

trigger CountyLookupTrigger on Account (before insert, before update) {

for(Account a: Trigger.new)
CountyLookupClass.CallWS(a);

}

 

 Apex class in invoke webservice

 

public class CountyLookupClass {


@future(callout=true)
public static void CallWS(String zcode){
//pass zipcode to ZipINfo
//get info
//parse to county__c
//create the stub
ZipLookup.ZipInfoSoap zipl = new ZipLookup.ZipInfoSoap();

//instantiate and setup authentication information

zipl.LicenseInfo = new ZipUser.LicenseInfo();
zipl.LicenseInfo.RegisteredUser = new ZipUser.RegisteredUser();
zipl.LicenseInfo.RegisteredUser.UserID = 'withoutme@gmail.com';
zipl.LicenseInfo.RegisteredUser.Password='******';
//call web service
ZipLookup.SIWsOutputOfZipInfoResult zz = zipl.GetCityState('94131');
String c = zz.ServiceResult.Code;
System.debug('Codeis' + c);
//ZipLookup.ZipInfoResult z = zipl.GetCityState('85281').;

}}

 

 

 

 

How do I test this? Am I doing it right?

 

 

 

And the apex from wsdl2apex.wsdl fom http://www.strikeiron.com/productdetail.aspx?p=436

 

 


 

Message Edited by vviyer on 04-09-2009 10:33 PM
Message Edited by vviyer on 04-09-2009 11:44 PM
Message Edited by vviyer on 04-09-2009 11:45 PM
  • April 09, 2009
  • Like
  • 0

I want to render a page block section depending on whether the user check a checkbox. I'm using action support tag to render the page block section on action"on lick". The page renders when I check it. But it doesntdisappear when I uncheck it?

here is theh VF page

 

<apex:outputPanel >
<apex:outputLabel value="Add Organization Affiliation?" for="theAff"/>
<apex:inputCheckbox value="{!renderAffiliation}" id="theAff"/>
<apex:actionSupport event="onclick" rerender="affsection"/>
</apex:outputPanel>

<apex:outputPanel id="affsection">
<apex:pageBlockSection title="Organization Affiliations" rendered="{!renderAffiliation}">
<apex:inputField value="{!affiliations.npe5__Organization__c}"/>
<apex:inputField value="{!affiliations.npe5__Description__c}"/>
<apex:inputField value="{!affiliations.npe5__Role__c}"/>
<apex:inputField value="{!affiliations.npe5__Status__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>

 THe controller get, set the renderAffiliation variable 

public Boolean renderAffiliation{get; set;}

 

 

 

 

Message Edited by vviyer on 04-08-2009 04:16 PM
  • April 08, 2009
  • Like
  • 0

Hi

Im a novice in VF and coding. Im writing a simple wizard for the Volunteer Management App. Add event info in step1, then click 'add participants" to go to participants to add participants.SFDC_Volunteer_Event__c (master) and SFDC_Volunteer_Participant__c(detail) are the objects. I have done this with a custom controller to replace the Events tab and it works!.

However, since I want to use the VF page to replace the "new" button, I need to use the standard controller and write an extension(right?).

 

2 VF pages VMXpage1, VMXPage2. 1 extension VMExtension.cls

Currently, I have only setup step 2, to add ONE participant, but I would like to extend it to add (like 'add row?". need inputs on how to do that too). but primarily, Im getting the error

 

Visualforce Page: /apex/VMXPage1

System.TypeException: Invalid conversion from runtime type SOBJECT:SFDC_Volunteer_Event__c to SOBJECT:SFDC_Volunteer_Participant__c

Class.VMExtension.<init>: line 9, column 21
External entry point

 

 

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

Here is the code




public class VMExtension{

SFDC_Volunteer_Event__c vevent;

SFDC_Volunteer_Participant__c vpart1;

public VMExtension(ApexPages.StandardController stdController){
this.vevent=(SFDC_Volunteer_Event__c)stdController.getRecord();
this.vpart1=(SFDC_Volunteer_Participant__c)stdController.getRecord();
}


public PageReference event(){
return Page.VMXPage1;
}

public PageReference addparts(){
return Page.VMXPage2;
}

public PageReference saveevent(){
insert vevent;
vpart1.Volunteer_Event__c=vevent.id;
insert vpart1;
PageReference veventPage = new PageReference('/'+vevent.id);
veventPage.setRedirect(true);
return veventPage;
}
}
------
Here is the VF page

<apex:page standardController="SFDC_Volunteer_Event__c" extensions="VMExtension">

<apex:sectionHeader title="New Event Information" subtitle="step 1/2"/>

<apex:form id="theform">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value=" Save Event" action="{!saveevent}"/>
<apex:commandButton value="Add Participants" action="{!addparts}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Information" columns="2">
<apex:inputField value="{!SFDC_Volunteer_Event__c.name}" required="true"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>


---
<apex:page standardController="SFDC_Volunteer_Participant__c" extensions="VMExtension">
<apex:sectionHeader title="Add Participants to Event:" subtitle="step 2/2"/>
<apex:form id="AddParticipantForm">
<apex:pageBLock >
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputLabel value="Contact1"/>
<apex:inputField value="{!SFDC_Volunteer_Participant__c.Contact__c}"/>


</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!event}" value="Edit Event Info"/>
<apex:commandButton action="{!saveevent}" value="Save Event"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBLock>
</apex:form>

</apex:page>
------

 

Im stuck. Please help. Thank you in advance

 

Message Edited by vviyer on 03-31-2009 05:40 PM
Message Edited by vviyer on 03-31-2009 05:41 PM
  • April 01, 2009
  • Like
  • 0

I'm learning to write apex code for calling out to external webservices. I started out with strikeIrons zipcode lookup. I'm new to webservices, so please help me out. Is this how I should go abt doing it?

1. Get WSDL. Generate apex.(done)

2. Created county__c field in account sObject(done)

3. Write before insert, before update trigger that passes the zipcode to CountyLookupClass.(done)

4. CountyLookupClass calls the @future webservice, passes the authentication parameters(username,password) and also the zipcode. 

5. StrikeIron authenticates. Returns county. 

6. Need to map the returned county name to Account.County__c field, so that it is added/inserted to the force.com database. 

 

Am I right? Here is the trigger

 

trigger CountyLookupTrigger on Account (before insert, before update) {

for(Account a: Trigger.new)
CountyLookupClass.CallWS(a);

}

 

 Apex class in invoke webservice

 

public class CountyLookupClass {


@future(callout=true)
public static void CallWS(String zcode){
//pass zipcode to ZipINfo
//get info
//parse to county__c
//create the stub
ZipLookup.ZipInfoSoap zipl = new ZipLookup.ZipInfoSoap();

//instantiate and setup authentication information

zipl.LicenseInfo = new ZipUser.LicenseInfo();
zipl.LicenseInfo.RegisteredUser = new ZipUser.RegisteredUser();
zipl.LicenseInfo.RegisteredUser.UserID = 'withoutme@gmail.com';
zipl.LicenseInfo.RegisteredUser.Password='******';
//call web service
ZipLookup.SIWsOutputOfZipInfoResult zz = zipl.GetCityState('94131');
String c = zz.ServiceResult.Code;
System.debug('Codeis' + c);
//ZipLookup.ZipInfoResult z = zipl.GetCityState('85281').;

}}

 

 

 

 

How do I test this? Am I doing it right?

 

 

 

And the apex from wsdl2apex.wsdl fom http://www.strikeiron.com/productdetail.aspx?p=436

 

 


 

Message Edited by vviyer on 04-09-2009 10:33 PM
Message Edited by vviyer on 04-09-2009 11:44 PM
Message Edited by vviyer on 04-09-2009 11:45 PM
  • April 09, 2009
  • Like
  • 0

I want to render a page block section depending on whether the user check a checkbox. I'm using action support tag to render the page block section on action"on lick". The page renders when I check it. But it doesntdisappear when I uncheck it?

here is theh VF page

 

<apex:outputPanel >
<apex:outputLabel value="Add Organization Affiliation?" for="theAff"/>
<apex:inputCheckbox value="{!renderAffiliation}" id="theAff"/>
<apex:actionSupport event="onclick" rerender="affsection"/>
</apex:outputPanel>

<apex:outputPanel id="affsection">
<apex:pageBlockSection title="Organization Affiliations" rendered="{!renderAffiliation}">
<apex:inputField value="{!affiliations.npe5__Organization__c}"/>
<apex:inputField value="{!affiliations.npe5__Description__c}"/>
<apex:inputField value="{!affiliations.npe5__Role__c}"/>
<apex:inputField value="{!affiliations.npe5__Status__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>

 THe controller get, set the renderAffiliation variable 

public Boolean renderAffiliation{get; set;}

 

 

 

 

Message Edited by vviyer on 04-08-2009 04:16 PM
  • April 08, 2009
  • Like
  • 0

Hi

Im a novice in VF and coding. Im writing a simple wizard for the Volunteer Management App. Add event info in step1, then click 'add participants" to go to participants to add participants.SFDC_Volunteer_Event__c (master) and SFDC_Volunteer_Participant__c(detail) are the objects. I have done this with a custom controller to replace the Events tab and it works!.

However, since I want to use the VF page to replace the "new" button, I need to use the standard controller and write an extension(right?).

 

2 VF pages VMXpage1, VMXPage2. 1 extension VMExtension.cls

Currently, I have only setup step 2, to add ONE participant, but I would like to extend it to add (like 'add row?". need inputs on how to do that too). but primarily, Im getting the error

 

Visualforce Page: /apex/VMXPage1

System.TypeException: Invalid conversion from runtime type SOBJECT:SFDC_Volunteer_Event__c to SOBJECT:SFDC_Volunteer_Participant__c

Class.VMExtension.<init>: line 9, column 21
External entry point

 

 

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

Here is the code




public class VMExtension{

SFDC_Volunteer_Event__c vevent;

SFDC_Volunteer_Participant__c vpart1;

public VMExtension(ApexPages.StandardController stdController){
this.vevent=(SFDC_Volunteer_Event__c)stdController.getRecord();
this.vpart1=(SFDC_Volunteer_Participant__c)stdController.getRecord();
}


public PageReference event(){
return Page.VMXPage1;
}

public PageReference addparts(){
return Page.VMXPage2;
}

public PageReference saveevent(){
insert vevent;
vpart1.Volunteer_Event__c=vevent.id;
insert vpart1;
PageReference veventPage = new PageReference('/'+vevent.id);
veventPage.setRedirect(true);
return veventPage;
}
}
------
Here is the VF page

<apex:page standardController="SFDC_Volunteer_Event__c" extensions="VMExtension">

<apex:sectionHeader title="New Event Information" subtitle="step 1/2"/>

<apex:form id="theform">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value=" Save Event" action="{!saveevent}"/>
<apex:commandButton value="Add Participants" action="{!addparts}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Information" columns="2">
<apex:inputField value="{!SFDC_Volunteer_Event__c.name}" required="true"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>


---
<apex:page standardController="SFDC_Volunteer_Participant__c" extensions="VMExtension">
<apex:sectionHeader title="Add Participants to Event:" subtitle="step 2/2"/>
<apex:form id="AddParticipantForm">
<apex:pageBLock >
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputLabel value="Contact1"/>
<apex:inputField value="{!SFDC_Volunteer_Participant__c.Contact__c}"/>


</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!event}" value="Edit Event Info"/>
<apex:commandButton action="{!saveevent}" value="Save Event"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBLock>
</apex:form>

</apex:page>
------

 

Im stuck. Please help. Thank you in advance

 

Message Edited by vviyer on 03-31-2009 05:40 PM
Message Edited by vviyer on 03-31-2009 05:41 PM
  • April 01, 2009
  • Like
  • 0

Hello Friends,

 

Of late i was trying my hand at using the TabPanel component provided in VF. Unfortunately got stuck :(

 

I have 2 tabs in the TabPanel. I want to call an Action method whenever the user selects either of these. So, basically, before the tab is rendered, this action method should execute!!

 

Do ActionFunction/ActionSupport work with Tab component?? I tried using them, but no luck :(

 

Please let me know if i am missing something or is it not supported/possible???

 

Many Thanks,

Cool_D