• juppy
  • NEWBIE
  • 75 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 16
    Replies
Hi good people,
I'm building a Lightning Experience prototype for the desktop.
I have placed a Lightning component on the Opportunity detail page. This component will display the results of a server-side query that uses the Opportunity id (and other Opportunity data) as filters in the query.
The component is linked to an Apex class (controller="xxx") and implements force:recordTab.
How do I pass details of the Opportunity record through to the Apex class?
Thanks in advance!
  • September 16, 2015
  • Like
  • 0
Here's a good one... I have a need to pass a list of sObjects as a JSON string, however the deserialise is failing with the above error when these sObjects are User records. Any ideas?
You can run this code in execute anonymous to reproduce the fault:

            SObjectType sObjType = Schema.getGlobalDescribe().get('user');
            set<string>    set_AllFieldNames    = sObjType.getDescribe().fields.getMap().keySet();
            string strQuery = 'select ' + String.join(new List<String>(set_AllFieldNames), ', ');
            strQuery += ' from user ';
            list<sObject> li_sObjects = database.query(strQuery);
            string JSONstring = JSON.serialize(li_sObjects);

            list<sObject> li_sObjects2 = (list<sObject>) JSON.deserialize(JSONstring, list<sObject>.class);

Thanks in advance!
  • December 26, 2014
  • Like
  • 0
Hi everyone, I'm trying to use visualforce to create a gauge image showing target and actual values.
Whatever I do I can only get the first data value (and hence the first colour) to show on the gauge.
The 'data' attribute points to a list of strings.
Has anyone got this to work?
Thanks in advance
  • November 26, 2014
  • Like
  • 0

Hi all,

I have a client who has a couple of hundred pdf documents he wants to load into and view in sf - not enough to make it worthwhile using a document storage solution.

 

I can load a pdf as an attachment, and retrieve that in apex, but cannot get the attachment body to display on a vf page.

 

Does anyone know if this can be done please - and how to go about it?

 

Thanks!

  • November 21, 2011
  • Like
  • 0

Hi all,

this is frustrating me, would appreciate any suggestions.

 

I have a VF controller that does an http callout and the VF page shows a spinner while this is happening - no problem.

However it sometimes happens that the callout fails and I want to show an error message before redirecting back to an Account detail page.

For some reason the error message is never shown.

Debug logs show me that I am executing the code as expected and the values of the error message and the flags are as expected.

The utility calls below check and clear a static boolean I use to indicate the callout state.

Code follows - thanks in advance for your help

 

VF page

    <apex:form >
        <apex:actionPoller action="{!checkStatus}" interval="5" reRender="theSpinnerPanel, theErrorMessagePanel" />
        <apex:outputPanel id="theSpinnerPanel" rendered="{!NOT(mp_bInError)}" >
            <apex:panelGrid columns="1" border="0" rules="none" cellspacing="2" cellpadding="2" columnClasses="colaligncenter" >
                <apex:image value="{!$Resource.Sqware_Peg_Searching_animation}" />
            </apex:panelGrid>
        </apex:outputPanel>
        <apex:outputPanel id="theErrorMessagePanel" rendered="{!(mp_bInError)}" >
            <apex:outputText value="{!mp_strErrorMessage}" styleClass="messageErrorText" />
        </apex:outputPanel>
    </apex:form>

 

Controller

    public pageReference checkStatus()
    {
        // Check to see if we have finished
        if (SP_Utilities.CalloutInProgress())
        {
            return null;
        }

        if (m_bErrorMessageDisplayed)
        {
            return doReturn();
        }

        if (mp_bInError)
        {
            m_bErrorMessageDisplayed = true;
            return null;
        }

        // Check the callout was successful
        if (m_liFootprintCasestoInsert.isEmpty())
        {
            mp_strErrorMessage = '*** Refresh failed ***';

            SP_Utilities.clearCalloutInProgress();
            mp_bInError = true;
            return null;
        }

 

 

<code for successful callout processing follows>

  • November 14, 2011
  • Like
  • 0

Having a frustrating time trying to create an interface to another database.

The other system has a wsdl like this:

 

<xs:complexType name="createIdentityResponse">
  <xs:complexContent>
    <xs:extension base="tns:response">
      <xs:sequence>
        <xs:element minOccurs="0" name="identityDetails" type="tns:identityDetails"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

 

From this, wsdl2apex creates this apex:

 

    public class response
    {
        public ServiceIdentitymanagemen.errors_element errors;
        private String[] errors_type_info = new String[]{'errors','urn:xxxx:service:identitymanagement:1.0','errors_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'errors'};
    }

    public class errors_element
    {
        public ServiceIdentitymanagemen.error[] error;
        private String[] error_type_info = new String[]{'error','urn:xxxx:service:identitymanagement:1.0','error','0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'error'};
    }

    public class createIdentityResponse response
    {
        public ServiceIdentitymanagemen.identityDetails identityDetails;
        private String[] identityDetails_type_info = new String[]{'identityDetails','urn:xxxx:service:identitymanagement:1.0','identityDetails','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'identityDetails'};
    }

 

Note that there is no apparent link between response (which has error details) and the createIdentityResponse which has details of the successfully created record. Consequently at runtime I get the error:

Unable to parse callout response. Apex type not found for element errors

 

I've seen similar problems described in this forum but none with an answer; I'm hoping someone can help with this because it seems to me all I need to do is establish the inheritance relationship between 'response' and 'createIdentityResponse', something like this:

 

public class createIdentityResponse extends response

 

Unfortunately, that didn't seem to work for me. Any better ideas? I'm running up against a hard deadline here so any help appreciated.

  • July 06, 2011
  • Like
  • 0

Hi guys,

I'm trying to do a SOAP-based callout to an external webservice and am frustrated by the above error.

What makes it worse is I am unable to get anything out of the debug logs that helps. The callout looks (to me) to be correctly formed.

 

However, the receiving system (non-salesforce) is apparently not seeing my login attempt.

A question that shows my relative inexperince with webservices: how can I be sure I am doing a 'POST' and not a 'GET'?

 

Pseudo-code follows.

The references to 'Identitymanagemen' are to classes generated from wsdl that represents the other webservice.

As you can see there is nothing tricksy in my code so suggestions on a strategy for debugging that code appreciated.

 

My business sponsor is evangelising the use of sfdc in his company so a rapid response would be most welcome.

First correct answer wins a free drink at CloudForce*!

 

Many thanks in advance.

 

        Identitymanagemen.IdentityManagementServiceHttpPort SOAPMessage = new Identitymanagemen.IdentityManagementServiceHttpPort();
        SOAPMessage.endpoint_x    = SPCacheAIMMetadata.getServiceLocation();
        SOAPMessage.timeout_x        = 30000;
 
        // Set http header
        SOAPMessage.outputHttpHeaders_x = new Map<String, String>();

        string username = xxxxxx;
        string password = xxxxxx;
        Blob headerValue = Blob.valueOf(username + ':' + password);
        string authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        SOAPMessage.outputHttpHeaders_x.put('Authorization', authorizationHeader);

        Identitymanagemen.identityDetails thisReturnStub = new Identitymanagemen.identityDetails();

        thisReturnStub = SOAPMessage.getIdentity('test', 'test');

 

 

* I'm not going to CloudForce this year ;>) but I'll issue a raincheck

  • June 21, 2011
  • Like
  • 0

I have a multi-step wizard consisting of a single custom controller and a single VF page.

I need to do all my processing within one controller/page pair so I can keep track of my processing status and provide 'back' button functionality.

The VF page displays different sections depending on the settings of a series of booleans which correspond to the stages of the wizard.

 

My challenge is that about once in every four executions, usually in step 3 or 4, everything resets and the controller's constructor is called.

 

Debug logs show no obvious reason for this happening.

One thought is that I need to have the apex:page cache=true and I am testing that now.

However my client would prefer me not to cache anything unless I need to.

 

An interesting and frustrating problem, would be interested to hear if anyone else has experienced this behaviour?

  • March 08, 2011
  • Like
  • 0

Have seen similar posts and tried to follow the solution - but clearly I'm still missing something. Hoping one of you lovely people can help me out.

 

I am using an apex repeat to display a list of product details (using a custom class, not Product2). I want to be able to enter a value for Quantity and click on a commandlink to add a product from the list to a 'shopping cart'. I have no problem getting the outputtext data across, but cannot get the value I entered in the inputtext Quantity field.

A posted solution was to use custom getters/setter methods; I tried this and can indeed see my entered value in the debug log. So far so good, however I cannot figure out how to access this in my code!

 

Enough wittering, here's the code:

 

<apex:repeat value="{!mp_liAvailableProducts}" var="AvailableProd">
    <apex:commandLink action="{!actionAddProduct}" value="Add" id="theAddProductLink" >
        <apex:param name="AddProdId" value="{!AvailableProd.strProdId}" />
        <apex:param name="AddProdQuantity" value="{!AvailableProd.iProdQuantity}" />
    </apex:commandLink>
    <apex:inputText value="{!AvailableProd.iProdQuantity}" size="2" maxlength="2" />
        <a href="{!URLFOR($Action.Product2.View, AvailableProd.strProdId)}" target="_blank"> {!AvailableProd.strProdName} </a>
    <apex:outputText value="{!AvailableProd.strProdCode}" />
    <apex:outputText value="{!AvailableProd.strProdDesc}"/>
</apex:repeat>

 

 

    public class SPSelectProducts
    {
        public String    strProdId                            {get; set;}
        public String    strProdName                            {get; set;}
        public String    strProdCode                            {get; set;}
        public integer    iProdQuantity;
        public string    strProdDesc                            {get; set;}
       
        public SPSelectProducts(string ProductId, String ProductName, String ProductCode, integer ProductQuantity, string ProductDesc)
        {
            strProdId            = ProductId;
            strProdName            = ProductName;
            strProdCode            = ProductCode;
            iProdQuantity        = ProductQuantity;
            strProdDesc            = ProductDesc;
        }    

        // Custom setters for Quantity
        public integer getiProdQuantity()
        {
            return this.iProdQuantity;
        }

        public void setiProdQuantity(Integer value)
        {
            iProdQuantity = value;
            System.debug('****** Inside setter *****' + value);
        }    
    }

 

 

    public PageReference actionAddProduct()
    {
        SPSelectProducts sSPSP = m_mapAvailProds.get(ApexPages.currentPage().getParameters().get('AddProdId'));
        sSPSP.iProdQuantity = integer.valueOf(ApexPages.currentPage().getParameters().get('AddProdQuantity'));

 

 

At this point the 'AddProdQuantity' parameter is 0, which is why I went down the getter/setter method route.

The list mp_liAvailableProducts has all the product details with Quantity = 0.

Yet the ****** Inside setter ***** debug statement shows the value I entered in the list. This method is called once for each entry in the list, my entered value appears in the correct iteration.

 

Thanks in advance for your help,

Cheers

Mike

  • October 15, 2010
  • Like
  • 0
Hi good people,
I'm building a Lightning Experience prototype for the desktop.
I have placed a Lightning component on the Opportunity detail page. This component will display the results of a server-side query that uses the Opportunity id (and other Opportunity data) as filters in the query.
The component is linked to an Apex class (controller="xxx") and implements force:recordTab.
How do I pass details of the Opportunity record through to the Apex class?
Thanks in advance!
  • September 16, 2015
  • Like
  • 0
Hi all - 

Using Apex, did you ever had to subtract the business days from any given date? 
Like for ex: if I have to subtract from today 11/19/2014-10 days, it should exclude all the weekends and give me the final date 11/5/2014.
Please let me know if you have any function related to this requirement.
Thanks for looking into this.

Regards,
Priyanka

Hi All,

 

how to keep query out side of the loop .

 

my code is as below..

 

 public List<Double> getAmount()
    {   
    List<Training_Schedule__c> Training= new List<Training_Schedule__c>();
    List<Revenue_Schedule__c> revenue=new List<Revenue_Schedule__c>();
    revenue=[select id,Date__c from Revenue_Schedule__c where Price_Book_Name__c=:price[0].Id];     
    for(Integer k=0;k<revenue.size();k++)    
    {       
        Training=[select id,Amount__c,Revenue_Date__c from Training_Schedule__c where  Revenue_Schedule__c=:revenue[k].Id ];
        amt=0;    
        for(Integer j=0;j<Training.size();j++)
        {         
         if(Training[j].Amount__c!=null)
          {      
          amt=amt+(Training[j].Amount__c);                                 
          }                      
        }       
       Amount.add(amt);           
    }
    return Amount;            
   }

 

Thanks...

Hi all,

I have a client who has a couple of hundred pdf documents he wants to load into and view in sf - not enough to make it worthwhile using a document storage solution.

 

I can load a pdf as an attachment, and retrieve that in apex, but cannot get the attachment body to display on a vf page.

 

Does anyone know if this can be done please - and how to go about it?

 

Thanks!

  • November 21, 2011
  • Like
  • 0

Hi,

 

Can we sort the column of  pageBlockTable on click of Column Header whitespace not on the Text.

I have implemented by clicking on Text. Is there any way that on click on the white space we can sort.

Is there any work around Please Reply.

 

Thanks.

Rehan Dawt.

Hi all,

this is frustrating me, would appreciate any suggestions.

 

I have a VF controller that does an http callout and the VF page shows a spinner while this is happening - no problem.

However it sometimes happens that the callout fails and I want to show an error message before redirecting back to an Account detail page.

For some reason the error message is never shown.

Debug logs show me that I am executing the code as expected and the values of the error message and the flags are as expected.

The utility calls below check and clear a static boolean I use to indicate the callout state.

Code follows - thanks in advance for your help

 

VF page

    <apex:form >
        <apex:actionPoller action="{!checkStatus}" interval="5" reRender="theSpinnerPanel, theErrorMessagePanel" />
        <apex:outputPanel id="theSpinnerPanel" rendered="{!NOT(mp_bInError)}" >
            <apex:panelGrid columns="1" border="0" rules="none" cellspacing="2" cellpadding="2" columnClasses="colaligncenter" >
                <apex:image value="{!$Resource.Sqware_Peg_Searching_animation}" />
            </apex:panelGrid>
        </apex:outputPanel>
        <apex:outputPanel id="theErrorMessagePanel" rendered="{!(mp_bInError)}" >
            <apex:outputText value="{!mp_strErrorMessage}" styleClass="messageErrorText" />
        </apex:outputPanel>
    </apex:form>

 

Controller

    public pageReference checkStatus()
    {
        // Check to see if we have finished
        if (SP_Utilities.CalloutInProgress())
        {
            return null;
        }

        if (m_bErrorMessageDisplayed)
        {
            return doReturn();
        }

        if (mp_bInError)
        {
            m_bErrorMessageDisplayed = true;
            return null;
        }

        // Check the callout was successful
        if (m_liFootprintCasestoInsert.isEmpty())
        {
            mp_strErrorMessage = '*** Refresh failed ***';

            SP_Utilities.clearCalloutInProgress();
            mp_bInError = true;
            return null;
        }

 

 

<code for successful callout processing follows>

  • November 14, 2011
  • Like
  • 0

Having a frustrating time trying to create an interface to another database.

The other system has a wsdl like this:

 

<xs:complexType name="createIdentityResponse">
  <xs:complexContent>
    <xs:extension base="tns:response">
      <xs:sequence>
        <xs:element minOccurs="0" name="identityDetails" type="tns:identityDetails"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

 

From this, wsdl2apex creates this apex:

 

    public class response
    {
        public ServiceIdentitymanagemen.errors_element errors;
        private String[] errors_type_info = new String[]{'errors','urn:xxxx:service:identitymanagement:1.0','errors_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'errors'};
    }

    public class errors_element
    {
        public ServiceIdentitymanagemen.error[] error;
        private String[] error_type_info = new String[]{'error','urn:xxxx:service:identitymanagement:1.0','error','0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'error'};
    }

    public class createIdentityResponse response
    {
        public ServiceIdentitymanagemen.identityDetails identityDetails;
        private String[] identityDetails_type_info = new String[]{'identityDetails','urn:xxxx:service:identitymanagement:1.0','identityDetails','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:xxxx:service:identitymanagement:1.0','false','false'};
        private String[] field_order_type_info = new String[]{'identityDetails'};
    }

 

Note that there is no apparent link between response (which has error details) and the createIdentityResponse which has details of the successfully created record. Consequently at runtime I get the error:

Unable to parse callout response. Apex type not found for element errors

 

I've seen similar problems described in this forum but none with an answer; I'm hoping someone can help with this because it seems to me all I need to do is establish the inheritance relationship between 'response' and 'createIdentityResponse', something like this:

 

public class createIdentityResponse extends response

 

Unfortunately, that didn't seem to work for me. Any better ideas? I'm running up against a hard deadline here so any help appreciated.

  • July 06, 2011
  • Like
  • 0

HI!

i know about dataloader or report but i have to create the csv with a specific lines and data.

So.. my ideia is to have a button that on clicking export a csv file.

Anyone has an example of that?

many tks

Hi guys,

I'm trying to do a SOAP-based callout to an external webservice and am frustrated by the above error.

What makes it worse is I am unable to get anything out of the debug logs that helps. The callout looks (to me) to be correctly formed.

 

However, the receiving system (non-salesforce) is apparently not seeing my login attempt.

A question that shows my relative inexperince with webservices: how can I be sure I am doing a 'POST' and not a 'GET'?

 

Pseudo-code follows.

The references to 'Identitymanagemen' are to classes generated from wsdl that represents the other webservice.

As you can see there is nothing tricksy in my code so suggestions on a strategy for debugging that code appreciated.

 

My business sponsor is evangelising the use of sfdc in his company so a rapid response would be most welcome.

First correct answer wins a free drink at CloudForce*!

 

Many thanks in advance.

 

        Identitymanagemen.IdentityManagementServiceHttpPort SOAPMessage = new Identitymanagemen.IdentityManagementServiceHttpPort();
        SOAPMessage.endpoint_x    = SPCacheAIMMetadata.getServiceLocation();
        SOAPMessage.timeout_x        = 30000;
 
        // Set http header
        SOAPMessage.outputHttpHeaders_x = new Map<String, String>();

        string username = xxxxxx;
        string password = xxxxxx;
        Blob headerValue = Blob.valueOf(username + ':' + password);
        string authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        SOAPMessage.outputHttpHeaders_x.put('Authorization', authorizationHeader);

        Identitymanagemen.identityDetails thisReturnStub = new Identitymanagemen.identityDetails();

        thisReturnStub = SOAPMessage.getIdentity('test', 'test');

 

 

* I'm not going to CloudForce this year ;>) but I'll issue a raincheck

  • June 21, 2011
  • Like
  • 0

I want to pass the ID of the Contact from my VisualForce Email Template up to the Controller, via the Custom Component, so that the Controller can query Events for just this Contact.  However, I seem to be getting stuck at Component to Controller.

 

Per the VF Developer's Guide, under "Custom Component Controllers", step 3 says, "In the <apex:attribute> tag in your component definition, use the assignTo attribute to bind the attribute to the class variable you just defined."  However, I am finding this never sets the value in the Controller - just within the Component.  Is the Guide wrong or do I have an error?

 

Here is a snippet of the Component code:

 

<apex:component controller="EmailApptController" access="global">

    <apex:attribute name="ToID" type="ID" description="the account ID" assignTo="{!contactID}"/>
    <apex:attribute name="Something" type="String" description="something to assign" assignTo="{!something}"/>

 

 

And the relevant Controller:

 

public class EmailApptController {
	public List<Event> appts {get; set;}
	public String message {get; set;}
	public ID contactID {get; set;}
	public String something {get; set;}
	
	public EmailApptController() {
		datetime yaynow = datetime.now();
		appts = [SELECT WhoId, WhatId, OwnerId, Subject, StartDateTime, Result__c, Confirmation_Status__c, Location_Map_URL__c, Location__c, Location_Address__c, Location_City_State_Zip__c, Location_Directions__c, Location_Directions_2__c
					FROM Event
					WHERE WhoId = :contactID
					AND StartDateTime >= :yaynow
					AND Result__c != 'Cancelled'
					AND Result__c != 'Rescheduled'];
					
		if (appts.isEmpty()){
        	message = 'There are no pending appointments for this client: ' + contactID + ' and something is: '+ something;
        }
	}
	
}

 

 

contactID and 'something' always return null from the controller, but when I access them in the Component they are fine.

 

I have found this post in the wiki re Controller Component Communication, but it's way over my head and seems overkill if all I want to do is grab this one ID.  Any thoughts?

 

 

  • February 15, 2011
  • Like
  • 1

Have seen similar posts and tried to follow the solution - but clearly I'm still missing something. Hoping one of you lovely people can help me out.

 

I am using an apex repeat to display a list of product details (using a custom class, not Product2). I want to be able to enter a value for Quantity and click on a commandlink to add a product from the list to a 'shopping cart'. I have no problem getting the outputtext data across, but cannot get the value I entered in the inputtext Quantity field.

A posted solution was to use custom getters/setter methods; I tried this and can indeed see my entered value in the debug log. So far so good, however I cannot figure out how to access this in my code!

 

Enough wittering, here's the code:

 

<apex:repeat value="{!mp_liAvailableProducts}" var="AvailableProd">
    <apex:commandLink action="{!actionAddProduct}" value="Add" id="theAddProductLink" >
        <apex:param name="AddProdId" value="{!AvailableProd.strProdId}" />
        <apex:param name="AddProdQuantity" value="{!AvailableProd.iProdQuantity}" />
    </apex:commandLink>
    <apex:inputText value="{!AvailableProd.iProdQuantity}" size="2" maxlength="2" />
        <a href="{!URLFOR($Action.Product2.View, AvailableProd.strProdId)}" target="_blank"> {!AvailableProd.strProdName} </a>
    <apex:outputText value="{!AvailableProd.strProdCode}" />
    <apex:outputText value="{!AvailableProd.strProdDesc}"/>
</apex:repeat>

 

 

    public class SPSelectProducts
    {
        public String    strProdId                            {get; set;}
        public String    strProdName                            {get; set;}
        public String    strProdCode                            {get; set;}
        public integer    iProdQuantity;
        public string    strProdDesc                            {get; set;}
       
        public SPSelectProducts(string ProductId, String ProductName, String ProductCode, integer ProductQuantity, string ProductDesc)
        {
            strProdId            = ProductId;
            strProdName            = ProductName;
            strProdCode            = ProductCode;
            iProdQuantity        = ProductQuantity;
            strProdDesc            = ProductDesc;
        }    

        // Custom setters for Quantity
        public integer getiProdQuantity()
        {
            return this.iProdQuantity;
        }

        public void setiProdQuantity(Integer value)
        {
            iProdQuantity = value;
            System.debug('****** Inside setter *****' + value);
        }    
    }

 

 

    public PageReference actionAddProduct()
    {
        SPSelectProducts sSPSP = m_mapAvailProds.get(ApexPages.currentPage().getParameters().get('AddProdId'));
        sSPSP.iProdQuantity = integer.valueOf(ApexPages.currentPage().getParameters().get('AddProdQuantity'));

 

 

At this point the 'AddProdQuantity' parameter is 0, which is why I went down the getter/setter method route.

The list mp_liAvailableProducts has all the product details with Quantity = 0.

Yet the ****** Inside setter ***** debug statement shows the value I entered in the list. This method is called once for each entry in the list, my entered value appears in the correct iteration.

 

Thanks in advance for your help,

Cheers

Mike

  • October 15, 2010
  • Like
  • 0

is there a way to convert a list of sobjects into a string?  I don't really care about the format, just that the field values can be string searched. Something like this:

 

 

List<sobject> pparcels = database.query('select ...');
String relatedMatches = pparcels.toString(); //toString doesn't exist
if (relatedMatches.indexOf(affectedIds[i]) > -1) {
...
}

 

 

  • June 22, 2010
  • Like
  • 0
How do i resolve this...This is my code...I am sending an XML to an endpoint n number of times(its in a for loop)...Cant i do that?

public PageReference saveUsers() {
String[] listOfSelectedUsers = getUsers();
String domainId = System.currentPageReference().getParameters().get('ex');
for(String presentVar: listOfSelectedUsers)
{

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://84.40.30.147/cm/spws');
req.setMethod('POST');

TestExtranet__c extranet = [select Extranet_Name__c from TestExtranet__c where id = :domainId];
Lead lead = [select id,firstname,lastname,email from Lead where id = :presentVar];
String requestXML = buildXMLRequest('createUser',extranet.Extranet_Name__c,lead.id,lead.firstname,lead.lastname,lead.email);

req.setBody(requestXML);
HttpResponse res = h.send(req);
XmlStreamReader reader = res.getXmlStreamReader();
boolean errorExists = parseResponseForError(reader);
if(!errorExists)
{
Extranet_User_Mapping__c mapping = new Extranet_User_Mapping__c();
mapping.Extranet_Id__c = domainId;
mapping.Leads__c = presentVar;
insert mapping;
}else
{

}


}
PageReference userConfPage = new PageReference('/apex/userConfirmation?ex='+ System.currentPageReference().getParameters().get('ex'));
return Page.userConfirmation;
}