• bbrantly1
  • NEWBIE
  • 209 Points
  • Member since 2009

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 50
    Replies
Can an external page (like web to lead) that is hosted externally developed using Visualforce or is it only the pages hosted on the SFDC Cloud can be developed in VF?

Thanks
i am reallu confused with the rendered attribute . how should we compute the formula . I want to create a formula related to opportunity object
  • July 05, 2009
  • Like
  • 0

 I was trying to see if I can do it with something like this.

 

 

public boolean productAndServicesPod { get; set;} {if(quotes.size()==0)productAndServicesPod=false;}

 


 

I want to pass the javascript function's arguments to controller through actionFunction but I am not sure if  I am doing it right...here is the visual force code snippet that I am working..

 

         <apex:form >
                 <apex:actionFunction name="populateFields" action="{!populateFields}" rerender="Email" status="Estatus"/>
                 <apex:param name="ename" value="{!custObj.Employee_Email__c}" assignTo="{!populateFields}" />
                
         <apex:pageBlock mode="edit" id="thePageBlock">
         
         <apex:actionRegion >
         <apex:pageBlockSection columns="1">                                     
             <apex:inputField value="{!custObj.Employee_Name__c}" onselect="populateFields" id="name"/>    
         </apex:pageBlockSection>

....

.......

</form>

 

 

and in controller

 

public Contact populateFields(String empName) {

 

// I want to get the inputField value from Visual force page here when the onselect event happens

 

}

 

 

I have a String dtme = "July 1, 2009 10:00 AM".   I need to convert it to a DateTime in APEX.   Would someone be able to show me the code to do this properly?

 

any help is much appreciated.

 

thanks

 Hi,  I am getting the error "SObject row was retrieved via SOQL without querying the requested field: Conference__c.Technology_Types__c.  Class.SimilarConferencesController.: line 7, column 76 External entry point " when I try to launch my Visualforce page.

Here is my controller code:

 

public class SimilarConferencesController {

private final String conf_type;

public SimilarConferencesController() {
conf_type = [select id, name from Conference__c where id =
:ApexPages.currentPage().getParameters().get('id')].Technology_Types__c;


}



public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select id,name from Conference__c where Technology_Types__c = :conf_type]));
}
return setCon;
}
set;
}
public List<Conference__c> getSimilar() {
return (List<Conference__c>) setCon.getRecords();
}


}

 Here is the visualforce code just in case:

 

 

<apex:page controller="SimilarConferencesController" title="Conferences Like Me">

<apex:pageBlock title="Similar Conferences">
<apex:pageBlockTable value="{!similar}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageBlockTable>

</apex:pageBlock>

</apex:page>

 

 

 

 I've followed the API's examples and I can't figure out what the actual problem is.  I found similar posts, but they didn't help me out very much.  Can anyone shed light on this?  I'm just trying to query the database to display Conference records whose technology type field match the source conference (its a custom link that triggers the visualforce page).

 

I feel like this is a mistake a lot of beginner's make (I'm on day 2 of APEX developement...).

 

I'm trying to access a sandbox with the salesforce mobile SDK. I've created a new Hybrid ios project, followed the normal process of putting the remote access key in, removing/re-adding the www folder, etc. I've deployed the app to my ipad and tested on the local simulator. 

 

I have some screenshots which can be found here

https://www.dropbox.com/sh/u2eur60ftxjyohh/QRoezFNLT8

I'm trying to figure out if there is a way to return some "results" from a batchable interface?  Example:

 

Batch Code:

global class QuickBatch implements Database.Batchable<sObject>, Database.Stateful{ global final String Query; global string Summary; global QuickBatch(String q) { Query=q; Summary = ''; } global Database.QueryLocator start(Database.BatchableContext BC){ return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<sObject> scope) { for(sObject s : scope) { Summary += ',' + s.get('id'); } } global void finish(Database.BatchableContext BC){ } }

 

Apex Controller

 

public with sharing class BatchTest { public BatchTest() { rValue = 'started'; } public QuickBatch q = new QuickBatch('SELECT ID FROM ACCOUNT'); public void Start() { string batchprocessid = Database.executeBatch(q,1); } public string rValue {get;set;} public void GetResultsFunction() { rValue = 'DONE:' + q.Summary; } }

 

For testing I have created a Visualforce page which calls "Start" from a CommandButton.  I then wait for the job to finish, then click a second button which executes "GetResultsFunction" and ReRenders an OutputPanel.

 

I never get a return from q.Summary though.  I know the jobs run asynchronously, but I was hoping it was somehow "store" the results so they can be obtained.  It doesn't look like it is possible. 

 

Does anyone know how to do this? if it can't be done, what is the best way to obtain results from a batchable interface that say does a mass calcuation of some type? store a temp record?

 

Thanks for any and all help.

Hello

 

I'm trying to write a test method for isCurrentUserLicensed

 

In my class's Constructor I do a couple of checks to make sure the user is licensed for other tools that are needed by this tool.

 

Example:

 

public ClassName() { if (!UserInfo.isCurrentUserLicensed('TOOLONE')) { isAbleToUseTool = false; LicenseError = 'Error HERE' } else if (!UserInfo.isCurrentUserLicensed('TOOLTWO')) { sAbleToUseTool = false; LicenseError = 'Error HERE' } else { //Excecute Constructor } }

 

My Test Method is as Follows:

 

 

public static testMethod void ClassNameTest() { /////////////////////////////////////////////////////////////// //Create User Profile p = [SELECT Id FROM profile WHERE name='Standard User']; User u2 = new User(); u2.alias = 'newUser'; u2.email='newuser@testorg.com'; u2.emailencodingkey='UTF-8'; u2.lastname='Testing'; u2.languagelocalekey='en_US'; u2.localesidkey='en_US'; u2.timezonesidkey='America/Los_Angeles'; u2.username='newuser@testorg.com'; u2.profileid = p.Id; insert u2; u2 = [SELECT Id FROM User WHERE email='newuser@testorg.com']; ////////////////////////////////////////////////////////////// System.runAs(u2) { ClassName cNObj = new ClassName(); //RUN OTHER TEST METHODS.... } }

 

 

Becuase the "fake" user created isn't license for the packages i'm testing against in the isCurrentUserLicensed the rest of the functions in the class of course fail.

 

What is the proper way to create a test method for this scenario? Should I be using NoAccessException?

 

Thanks for any help offered.

 

Immediate Hiring Full-Time Salesforce.com / Asp.net Developer

We are a Charlotte, NC based company with a primary focus on customizing and deploying SalesForce applications to help SMB’s accomplish enterprise level task.

We are in the need of a full time Salesforce.com Developer.

Requirements:

1.       ASP.NET Experience (C# Preferred)

2.       Minimum One Year Apex / VisualForce (or Java) Development Experience

3.       XML Web Services Experience

4.       Willing to Relocated to Charlotte, NC or Atlanta, GA if currently living elsewhere.

Preferred Attributes:

1.       Salesforce Certification (Administrator, Developer, Consultant)

Job Details:

·         Full Time

·         Salary Amount Will Depend on Qualifications of Individuals.

Is it possible to insert a contact along with a contact role in the same binding.create call? If so can someone provide some sample code. I have tried:

Hi,

 

I have a vf controller from where I need to insert records into the userterritory table. However, I am receiving a compilation error which is as follows:-

Compile Error: DML not allowed on UserTerritory 
Is there any way to insert records into the UserTerritory table?
I have tried using an action function to call the controller method, but the compiler does not allow me to save the controller with the insert or the Database insert command on user territory table.
 
Any help is much appreciated.
 
Thanks in advance!!

I'm not the resident PHP developer, but our resource in-house has had the following issue:

 

We tried to upgrade our system from the Salesforce Partner PHP toolkit v11 to the latest v20.

 

However, we started experiencing some very strange results as soon as we switched to the new libraries. To confirm, we kept all the old working queries as is, so the issue is not with how we query or manipulate the data. The issue is that what Salesforce returns using the v20 toolkit is radically different and looks corrupt.  

 

We can switch the libraries back and forward (old and new) to produce the results below.

 

V11 returned the Object like:

 

SObject Object
(
    [type] => PricebookEntry
    [fields] => SimpleXMLElement Object
        (
            [UnitPrice] => 8.04
            [CurrencyIsoCode] => GBP
        )
    [sobjects] => Array
        (
            [0] => SObject Object
                (
                    [type] => Product2
                    [fields] => SimpleXMLElement Object
                        (
                            [Carbon_Database_id__c] => 12.0
                            [Id] => 01t20000000iTW4AAM
                            [Name] => Big River Salmon Creek Forestry
                            [Family] => Carbon Instruments
                            [IsActive] => true
                        )

                    [Id] => 01t20000000iTW4AAM
                )
            [1] => SObject Object
                (
                    [type] => Pricebook2
                    [fields] => SimpleXMLElement Object
                        (
                            [Name] => 3) >= 5
                            [IsActive] => true
                        )
                )
        )
)

 

V20 returned the Object like:

 

stdClass Object
(
    [type] => PricebookEntry
    [Id] => 
    [any] => Array
        (
            [Product2] => stdClass Object
                (
                    [type] => Product2
                    [Id] => Array
                        (
                            [0] => 01t20000000iTW4AAM
                            [1] => 01t20000000iTW4AAM
                        )
                    [any] => <sf:Carbon_Database_id__c>12.0</sf:Carbon_Database_id__c><sf:Id>01t20000000iTW4AAM</sf:Id><sf:Name>Big River Salmon Creek Forestry</sf:Name><sf:Family>Carbon Instruments</sf:Family><sf:IsActive>true</sf:IsActive>
                )
            [Pricebook2] => stdClass Object
                (
                    [type] => Pricebook2
                    [Id] => 
                    [any] => <sf:Name>3) &gt;= 5
                )
            [0] => <sf:UnitPrice>8.04</sf:UnitPrice><sf:CurrencyIsoCode>GBP</sf:CurrencyIsoCode>
        )
)

 

Notice how unstructured and a mess this is, it has jumbled all the relevant data into these <sf: tags.

 

This issue occurred on the first Query, here are the bones of that part:

 

$response = $mySforceConnection->query($query);
$queryResult = new QueryResult($response);

foreach ($queryResult->records as $record) {
print_r($record);

 

Does anybody know why the change from Version 13 to version 20 might have caused this change?

Hi,

 

We have implemented the tabbed accounts functionality.

we understand that inline edit is not available for Visualforce pages.

 

But we need to have the inline edit for the "details" tab panel.

 

Is there any workaround.....if yes  a brief overview on how to do it would be extremely helpful!

We are really stuck here!

  • September 15, 2010
  • Like
  • 0
Need to get increased code coverage.  I currently have 73%.  The lines highlight in red seem to be the problem.  I have received help to get to this point but I not sure of the code required to test the missing lines or how to get this above the required 75%.
Thanks
Ross

 

 

public class attendeeExt {
 2	 	  
 3	 1	   Attendee__c attendee;
 4	 	  
 5	 1	   public attendeeExt(ApexPages.StandardController ctlr){
 6	 	  
 7	 1	   this.attendee = (Attendee__c)ctlr.getRecord();
 8	 	   }
 9	 	  
 10	 0	   public Attendee__c getAttendee(){
 11	 0	   if(attendee == null) attendee = new Attendee__c();
 12	 0	   return attendee;
 13	 	   }
 14	 	  
 15	 1	   public PageReference Save(){
 16	 1	   try{
 17	 1	   insert attendee;
 18	 	   }
 19	 1	   catch(DmlException ex){
 20	 1	   ApexPages.addMessages(ex);
 21	 	   }
 22	 1	   PageReference pr = new PageReference('/'+attendee.Meeting_Note__c);
 23	 1	   pr.setRedirect(True);
 24	 1	   return pr;
 25	 	   }
 26	 	   public static testMethod void testattendeeExt() {
 27	 	   Contact c = new Contact(FirstName='Test', LastName='Contact');
 28	 	   insert c;
 29	 	  
 30	 	   Meeting_Note__c m = new Meeting_Note__c(Subject__c='Test');
 31	 	   insert m;
 32	 	  
 33	 	   Attendee__c a = new Attendee__c(Meeting_Note__c = m.id, Contact__c = c.id);
 34	 	   insert a;
 35	 	  
 36	 	   System.assertEquals(c.id,a.contact__c);
 37	 	  
 38	 	   ApexPages.StandardController sc = new ApexPages.StandardController(a);
 39	 	   attendeeext ae = new attendeeext(sc);
 40	 	   ae.save();
 41	 	   }
 42	 	  }

 

 

Hi,

 

I need to get the api names of the items of an object.

 

I can get the Name and Value with the getMap() method. But how i can get the API name.

I have a prefix problem with managed packets, so I need this thing.

 

e.g.

custom item in Contact >> married.

API name with prefix

prefix__married_c

 

how can i get this thing?

 

i can get with getMap() or getLabel() the married__c but not with prefix.

 

thanks for help.

 

greetings.

  • August 02, 2010
  • Like
  • 0

Hello everyone,

                             In the following piece of code I am unable to fetch the rows if the groupName consists of left open paranthesis '('  and right open paranthesis ')'.

 

for Eg: if groupName = Assisted Health program (AHP) Japan

 If i remove (AHP) then it is working fine. like if i have my groupname as 'Assisted Health Program'. I am able to fetch the rows.

 

So, how to fetch the rows even if it consists of paranthesis in the groupName?

 

 

 

this.groupName = ApexPages.currentPage().getParameters().get('group');
if (groupName != null) {
evs = [Select Time_Zone_Offset__c, Start_Time__c, Start_Date__c, Name, Id, End_Time__c From Offmax_cal__c where Business__c like :(groupName + '%')];

Hello

 

I'm trying to write a test method for isCurrentUserLicensed

 

In my class's Constructor I do a couple of checks to make sure the user is licensed for other tools that are needed by this tool.

 

Example:

 

public ClassName() { if (!UserInfo.isCurrentUserLicensed('TOOLONE')) { isAbleToUseTool = false; LicenseError = 'Error HERE' } else if (!UserInfo.isCurrentUserLicensed('TOOLTWO')) { sAbleToUseTool = false; LicenseError = 'Error HERE' } else { //Excecute Constructor } }

 

My Test Method is as Follows:

 

 

public static testMethod void ClassNameTest() { /////////////////////////////////////////////////////////////// //Create User Profile p = [SELECT Id FROM profile WHERE name='Standard User']; User u2 = new User(); u2.alias = 'newUser'; u2.email='newuser@testorg.com'; u2.emailencodingkey='UTF-8'; u2.lastname='Testing'; u2.languagelocalekey='en_US'; u2.localesidkey='en_US'; u2.timezonesidkey='America/Los_Angeles'; u2.username='newuser@testorg.com'; u2.profileid = p.Id; insert u2; u2 = [SELECT Id FROM User WHERE email='newuser@testorg.com']; ////////////////////////////////////////////////////////////// System.runAs(u2) { ClassName cNObj = new ClassName(); //RUN OTHER TEST METHODS.... } }

 

 

Becuase the "fake" user created isn't license for the packages i'm testing against in the isCurrentUserLicensed the rest of the functions in the class of course fail.

 

What is the proper way to create a test method for this scenario? Should I be using NoAccessException?

 

Thanks for any help offered.

 

I am trying to write the test method for the following controller extension:

 

public class MassCreateLeadsFromContactsControllerExt {
    public string CampaignToAppendID;
    public list<contact> SelectedContacts;
    public boolean CampaignAlert = False;
    public boolean noContact = False;
    public boolean isContact = True;
    public boolean ProcessEnded = False;
    public integer ContactNumber =0;
    public integer ContactsProcessed = 0;

    public MassCreateLeadsFromContactsControllerExt(ApexPages.StandardSetController stdSetController) {
        list<contact> TheSelectedIDs;
        System.LoggingLevel level = LoggingLevel.FINEST;
//        system.debug ('Starting extension controller');
//        system.debug ('CampaignAlert: '+CampaignAlert);

        TheSelectedIDs = (list<Contact>)stdSetController.getselected();       
        if (TheSelectedIDs.size() > 0) {
            this.selectedcontacts = new list<Contact>();
            for (contact TheCurrentContact : TheSelectedIDs) {
                contact TheFullContact = ([SELECT id, name, firstname, lastname, title, accountid, email, phone, mobilephone, mailingcity, mailingcountry FROM contact where id = :TheCurrentContact.ID]);
                this.SelectedContacts.add(TheFullContact);
            }
//            system.debug ('SelectedContacts: '+this.SelectedContacts.size());
            this.contactnumber = this.SelectedContacts.size();
            this.noContact = False;
            this.isContact = True;
        } else {
            system.debug ('No Contact in list');
            this.ContactNumber = 0;
            this.noContact = True;
            this.isContact = False;
        }        
    }
    
    public pagereference CreateLeadsFromContacts() {
        Lead TheNewLead;
        Campaignmember TheNewCM;
        Campaignmember ContactCM;
        Contact TheFullContact;
        account TheAccount;
        
        if (CampaignToAppendID != '0') {
            Campaign TheCampaign = ([SELECT id, name FROM campaign where id = :CampaignToAppendID]);
//            system.debug ('Campaign to append: '+CampaignToAppendID+' - '+TheCampaign.name);
//            system.debug ('Nb of leads to create: '+SelectedContacts.size());

            for (contact TheCurrentContact : SelectedContacts) {
//                system.debug ('Contact to process: '+TheCurrentContact.ID);
                TheFullContact = ([SELECT id, firstname, lastname, salutation, title, accountid, email, phone, mobilephone, mailingstreet, mailingcity, mailingcountry, mailingpostalcode FROM contact where id = :TheCurrentContact.ID]);
                TheAccount = ([SELECT id, name, industry FROM account where id = :TheFullContact.accountid]);
                TheNewLead = new lead ();
                TheNewLead.firstname = TheFullContact.firstname;
                TheNewLead.lastname = TheFullContact.lastname;
                TheNewLead.title = TheFullContact.title;
                TheNewLead.Company = TheAccount.name;
                TheNewLead.email = TheFullContact.email;
                TheNewLead.phone = TheFullContact.phone;
                TheNewLead.mobilephone = TheFullContact.mobilephone;
                TheNewLead.industry = TheAccount.industry;
                TheNewLead.street = TheFullContact.mailingstreet;
                TheNewLead.city = TheFullContact.mailingcity;
                TheNewLead.country = TheFullContact.mailingcountry;
                TheNewLead.postalcode = TheFullContact.mailingpostalcode;
                TheNewLead.salutation = TheFullContact.salutation;
                
                try {
                    insert TheNewLead;
                    this.ContactsProcessed = this.ContactsProcessed +1;
                } catch (exception e) {
                }
//                system.debug ('New Lead insterted - ID: '+TheNewLead.ID);
                TheNewCM = new campaignMember();
                TheNewCM.leadid = TheNewLead.ID;
                TheNewCM.campaignid = TheCampaign.ID;
                try {
                    contactCM = ([SELECT contactid, status FROM campaignmember where campaignid = :TheCampaign.ID and contactid = :TheCurrentContact.id limit 1]);
                    if (contactCM != null) {
                        TheNewCM.status = contactCM.status;
                    } 
                } catch (exception e) {
//                    system.debug ('No campaign memeber status. default value will be used');
                }
                insert TheNewCM;
            }
//            system.debug('END OF PROCESSING');
            this.ProcessEnded = True;
            this.isContact = False;
            this.CampaignAlert = False;
            }
        else {
            this.CampaignAlert = True;
            system.debug('No campaign selected');
            }
        return null;
    }

    public List<SelectOption> getCampaignList() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('0','-- No Campaign --'));
        for (campaign c : [SELECT id, name FROM campaign where isactive = TRUE order by name]) {
            options.add(new SelectOption(c.id,c.name));    
        }
//        system.debug('getCampaignsToAppend - Campaigns To Append drop list: '+options.size());
        return options;
    }

    public integer getContactNumber() {
        if (this.ContactNumber == null) {
            this.ContactNumber = 0;
        }
//        system.debug ('getContactNumber - ContactNumber: '+this.ContactNumber);
        return this.ContactNumber;
    }

    public integer getContactsProcessed() {
        if (this.ContactsProcessed == null) {
            this.ContactsProcessed = 0;
        }
//        system.debug ('getContactsProcessed - ContactsProcessed: '+this.ContactsProcessed);
        return this.ContactsProcessed;
    }

    public list<contact> getSelectedContacts() {
        if (This.SelectedContacts == null) {
            This.SelectedContacts = new List<contact>();
//            system.debug ('getSelectedContacts - found SelectedContacts null');
        }
//        system.debug ('getSelectedContacts - TheContacts: '+this.SelectedContacts.size());
        return This.SelectedContacts;
    }

    public string getCampaignToAppendID() {
        if(this.CampaignToAppendID == null) {
            this.CampaignToAppendID = '0';
        }
//        system.debug('getCampaignToAppend - CampaignToAppendID: '+this.CampaignToAppendID);
        return this.CampaignToAppendID;
    }

    public void setCampaignToAppendID(string c) {
        this.CampaignToAppendID = c;
//        system.debug('setCampaignToAppendID - CampaignToAppendID: '+this.CampaignToAppendID);
        if (CampaignToAppendID != '0') {
            Campaign TheCampaign = ([SELECT id, name FROM campaign where id = :this.CampaignToAppendID]);
//            system.debug ('Campaign to append: '+this.CampaignToAppendID+' - '+TheCampaign.name);
            }
    }

    public boolean getProcessEnded() {
        if (this.ProcessEnded == null) {
            this.ProcessEnded = True;           
        }
        return this.ProcessEnded;
    }

    public boolean getnoContact() {
        if (this.noContact == null) {
            this.noContact = True;           
        }
        return this.noContact;
    }
    public boolean getisContact() {
        if (this.isContact == null) {
            this.isContact = False;
        }
        return this.isContact;
    }
    
    public boolean getCampaignAlert() {
        if (CampaignAlert == null) {
            CampaignAlert = False;
        }
        return CampaignAlert;
    }
}

 

This is being used by the following page:

 

<apex:page standardController="contact" extensions="MassCreateLeadsFromContactsControllerExt" recordSetVar="contacts">
<script>
function confirmCancel() {
var isCancel = confirm("Are you sure you wish to cancel?");
if (isCancel) return true;
return false;
}
</script>

<apex:sectionHeader title="Mass Create Leads from Contacts"></apex:sectionHeader>
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Create leads" action="{!CreateLeadsFromContacts}" id="CLFC"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Lead creation parameters" collapsible="false" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel for="CampaignToAppendID">Attach resulting leads to campaign:</apex:outputLabel>
<apex:selectlist value="{!CampaignToAppendID}" multiselect="false" size="1">
<apex:selectOptions value="{!CampaignList}"/>
</apex:selectlist>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!CampaignAlert}">
<apex:outputLabel ><h1>Please select a campaign</h1></apex:outputLabel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!noContact}">
<apex:outputLabel ><h1>There is no contact to process</h1></apex:outputLabel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!isContact}">
<apex:outputLabel ><h1>Nb contacts to process: {!ContactNumber}</h1></apex:outputLabel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!ProcessEnded}">
<apex:outputLabel ><h1>{!ContactsProcessed} Contacts were processed</h1></apex:outputLabel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Contacts" columns="1" rendered="{!isContact}">
<apex:pageBlockSectionItem >
<apex:dataTable value="{!SelectedContacts}" var="TheContact" rowClasses="odd,even" styleClass="tableClass" width="100%">
<apex:column >
<apex:facet name="header">Name</apex:facet>
<apex:outputText value="{!TheContact.name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Title</apex:facet>
<apex:outputText value="{!TheContact.title}"/>
</apex:column>
<apex:column >
<apex:facet name="header">email</apex:facet>
<apex:outputText value="{!TheContact.email}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

The purpose is to select the contacts in a view and trigger a wizard that creates a lead for each contact and add the newly created leads to a campaign (which name is being prompted to the user).

 

I tried to write a unit test class that creates a list of contacts and instantiates the controller extension, passing this list of contacts but I have not been able to find out how I can do this.

 

Any hint?

 

My (useless, I am afraid) test code so far:

 

Public class TestLeadMassCreationWizard {

    public static testMethod void testLeadMassCreation() {
        System.Debug('Debugging...');
        System.Debug('Unit Test: lead Mass Creation and addition to campaign');
               
        list<contact> Clist = [select ID from contact where lastname like 'M%' limit 5];
        Campaign thecampaign = [select ID from Campaign where isactive = true limit 1];
       
        MassCreateLeadsFromContactsControllerExt TheController = new MassCreateLeadsFromContactsControllerExt<Clist>();
       
        string nextpage = ssc.CreateLeadsFromContacts().getURL();
    }
}

I am trying to access the inputtext field values in javascript through component but I am having hard time doing this..suppose I want to get the value of the field refered by id=reqname in a javascript function, how can I get it through $Component?

<apex:pageBlock mode="edit" id="thePageBlock"> <apex:pagemessages ></apex:pagemessages> <apex:actionRegion > <apex:pageBlockSection columns="1" id="remail"> <apex:inputText value="{!custObj.Requestor_Name__c}" id="reqname" />

 

 

 

Can an external page (like web to lead) that is hosted externally developed using Visualforce or is it only the pages hosted on the SFDC Cloud can be developed in VF?

Thanks

i want to have a pop up on standard pagelaout which is using a VF . this VF shud only be rendered if and only if a certain field has a conditional value and also the VF pop up shud ultimately pupulate the data in the output page  . my idea is to override the save button . any help will be very much welcome

 

thanks to all those who are making teh VF learning for newbies like us a cake walk

  • July 07, 2009
  • Like
  • 0

Hi Guys, I need some assistance with basic WebService. I have put together a dummy service using the Orders table in the Northwind Database which returns Dataset of all the Orders for a particular Customer. Requires CustomerID as Parameter.

 

Here is the XML when the Service is invoked with "ALFKI" customer id.

 

<?xml version="1.0" encoding="utf-8" ?>

- <DataSet xmlns=http://172.16.1.254>
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Table">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="OrderID" type="xs:int" minOccurs="0" />
  <xs:element name="CustomerID" type="xs:string" minOccurs="0" />
  <xs:element name="EmployeeID" type="xs:int" minOccurs="0" />
  <xs:element name="OrderDate" type="xs:dateTime" minOccurs="0" />
  <xs:element name="RequiredDate" type="xs:dateTime" minOccurs="0" />
  <xs:element name="ShippedDate" type="xs:dateTime" minOccurs="0" />
  <xs:element name="ShipVia" type="xs:int" minOccurs="0" />
  <xs:element name="Freight" type="xs:decimal" minOccurs="0" />
  <xs:element name="ShipName" type="xs:string" minOccurs="0" />
  <xs:element name="ShipAddress" type="xs:string" minOccurs="0" />
  <xs:element name="ShipCity" type="xs:string" minOccurs="0" />
  <xs:element name="ShipRegion" type="xs:string" minOccurs="0" />
  <xs:element name="ShipPostalCode" type="xs:string" minOccurs="0" />
  <xs:element name="ShipCountry" type="xs:string" minOccurs="0" />
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:choice>
  </xs:complexType>
  </xs:element>
  </xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <Table diffgr:id="Table1" msdata:rowOrder="0">
  <OrderID>10643</OrderID>
  <CustomerID>ALFKI</CustomerID>
  <EmployeeID>6</EmployeeID>
  <OrderDate>1997-08-25T00:00:00-04:00</OrderDate>
  <RequiredDate>1997-09-22T00:00:00-04:00</RequiredDate>
  <ShippedDate>1997-09-02T00:00:00-04:00</ShippedDate>
  <ShipVia>1</ShipVia>
  <Freight>29.4600</Freight>
  <ShipName>Alfreds Futterkiste</ShipName>
  <ShipAddress>Obere Str. 57</ShipAddress>
  <ShipCity>Berlin</ShipCity>
  <ShipPostalCode>12209</ShipPostalCode>
  <ShipCountry>Germany</ShipCountry>
  </Table>
+ <Table diffgr:id="Table2" msdata:rowOrder="1">
  <OrderID>10692</OrderID>
  <CustomerID>ALFKI</CustomerID>
  <EmployeeID>4</EmployeeID>
  <OrderDate>1997-10-03T00:00:00-04:00</OrderDate>
  <RequiredDate>1997-10-31T00:00:00-04:00</RequiredDate>
  <ShippedDate>1997-10-13T00:00:00-04:00</ShippedDate>
  <ShipVia>2</ShipVia>
  <Freight>61.0200</Freight>
  <ShipName>Alfred's Futterkiste</ShipName>
  <ShipAddress>Obere Str. 57</ShipAddress>
  <ShipCity>Berlin</ShipCity>
  <ShipPostalCode>12209</ShipPostalCode>
  <ShipCountry>Germany</ShipCountry>
  </Table>
+ <Table diffgr:id="Table3" msdata:rowOrder="2">
  <OrderID>10702</OrderID>
  <CustomerID>ALFKI</CustomerID>
  <EmployeeID>4</EmployeeID>
  <OrderDate>1997-10-13T00:00:00-04:00</OrderDate>
  <RequiredDate>1997-11-24T00:00:00-05:00</RequiredDate>
  <ShippedDate>1997-10-21T00:00:00-04:00</ShippedDate>
  <ShipVia>1</ShipVia>
  <Freight>23.9400</Freight>
  <ShipName>Alfred's Futterkiste</ShipName>
  <ShipAddress>Obere Str. 57</ShipAddress>
  <ShipCity>Berlin</ShipCity>
  <ShipPostalCode>12209</ShipPostalCode>
  <ShipCountry>Germany</ShipCountry>
  </Table>
 
</NewDataSet>
</diffgr:diffgram>
</DataSet>

 


 NOTE:  Customer can have one or more orders.
 
I have the following code which grabs the XML and stores it in MAP. I am using Map for the first time so need some assistance on how to iterate the MAP and grab values and store it in Custom Object.
 
 
global class WSUpdates{
 
      WebService static Integer InsertOrders(String CustomerName,String CustomerID, String UserName,String RecordID )
    {
           Map<string,string> Orders= new Map<string,string>();
   
           HttpRequest req = new HttpRequest();
           req.setEndpoint('http://http://172.16.1.254/dummywebservice/OrderInfo.asmx');
           req.setMethod('POST');
           req.setHeader('Content-Type', 'text/xml; charset=utf-8');
           req.setHeader('SOAPAction', 'http://http://172.16.1.254/GetOrders');
           
           string b = '<?xml version="1.0" encoding="utf-8"?>';
           b += '<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
           b += '<soap:Header>';
           b += '<ServiceAuthHeader xmlns="
http://172.16.1.254">';
           b += '<Username>Username</Username>';
           b += '<Password>Password</Password>';
           b += '</ServiceAuthHeader>';
           b += '</soap:Header>';
           b += '<soap:Body>';
           b += '<GetOrders xmlns="
http://172.16.1.254">';
           b += '<ID>' + CustomerID + '</ID>';
           b += '</GetOrders>';
           b += '</soap:Body>';
           b += '</soap:Envelope>';
           
           req.setBody(b);
       
           Http http = new Http();
           HTTPResponse res = http.send(req);
           XmlStreamReader reader = new XmlStreamReader(res.getBody());
           CustomOrder__c[] orders = new CustomOrder__c[0];
         
        
          while(reader.hasNext())
            {
                if (reader.getEventType() == XmlTag.START_ELEMENT)
                {
                    string FieldName = reader.getLocalName();
                    reader.next();
                    if (reader.getEventType() == XmlTag.CHARACTERS)
                    {
                        Orders.put(FieldName, reader.getText());
                    }
                }
                reader.next();
            }    
 
//I dont know how to proceed from here. What I am trying to do here is contact the WebService, and use XMLStreamreader to read the XML Response, parse it and store it in the MAP object. Need to iterate the MAP, get the values and store it in Custom Object.
//THis is just sample code i have put together
 
      
           Orders.add(new CustomOrder__c(ItemName='Dummy',OrderDate__c='Date',RequiredDate__c='REQDDate')); 
           insert Orders
            //return Orders.size();
    }
}
Thanks for your help.
 
Manny

 

 

I want to implement my own sObject which has similar functionality to

company profile => Holidays => Recurring Holiday

 

I was wondering if I could get the source code of Visual page and apex controller of it?

If so, it will save me tons of time.

 

thanks

 

I have a .Net application which uses salesforce api and resides on rackspace hosting company(Running on windows server 2003 ) .Is there is a way  to move that application to force.com server.I am just curious to know where force.com servers runs,applications built out side force.com like .net,java or php

I'm looking to fetch data from Salesforce.com in order to integrate into an ERP system.

Does anyone have any suggestions or sample code ?

 I was trying to see if I can do it with something like this.

 

 

public boolean productAndServicesPod { get; set;} {if(quotes.size()==0)productAndServicesPod=false;}

 


 

I want to pass the javascript function's arguments to controller through actionFunction but I am not sure if  I am doing it right...here is the visual force code snippet that I am working..

 

         <apex:form >
                 <apex:actionFunction name="populateFields" action="{!populateFields}" rerender="Email" status="Estatus"/>
                 <apex:param name="ename" value="{!custObj.Employee_Email__c}" assignTo="{!populateFields}" />
                
         <apex:pageBlock mode="edit" id="thePageBlock">
         
         <apex:actionRegion >
         <apex:pageBlockSection columns="1">                                     
             <apex:inputField value="{!custObj.Employee_Name__c}" onselect="populateFields" id="name"/>    
         </apex:pageBlockSection>

....

.......

</form>

 

 

and in controller

 

public Contact populateFields(String empName) {

 

// I want to get the inputField value from Visual force page here when the onselect event happens

 

}

 

 

Hi To all,

How to call External(.net) webservice from Salesforce???

& how to use that webservices in APEX classes & triggers????

Thanks,

Krishna.