• MikeBates.ax895
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I have a salesforce app that relies heavily on an external php application which is hosted on Amazon an Amazon EC2 instance.

 

I'd like to take advantage of the Amazon Simple Queue Service to send and receive all the data the 2 web services and exchanging. Amazon provide a php library I can use on my external app, but I'm going to need to implement it on force.com as well.

 

Has anyone had a look at using this service with force.com?

Does salesforce offer a similar service that I should look at using instead?

 

Thanks

Mike

I have a booking sheet that is dynamically built using XML. The page is basicaly a form with lots of checkboxes.

 

How can I set the name attribute of the checkboxes, and then howe do I read in the values in the controller extenstion class.

 

What I would like is for the page to have something structured liek this

 

<input type="checkbox" value="1" id="BookingSheetCheck881" name="data[BookingSheet][check][881]">

<input type="checkbox" value="1" id="BookingSheetCheck882" name="data[BookingSheet][check][882]">

<input type="checkbox" value="1" id="BookingSheetCheck883" name="data[BookingSheet][check][883]">

 

Then somehow loop through the resulting $_POST params which would be structured as a nested array, something like:

$_POST[ 'BookingSheet' ][ 'check' ][ '881' ]

$_POST[ 'BookingSheet' ][ 'check' ][ '882' ]

$_POST[ 'BookingSheet' ][ 'check' ][ '883' ]

I'm trying to create a custom Link (or Button) that will open up an apex page I built and have 2 problems.

 

First problem

I've been trying to use the page as a Content Source as it's not listed, looking at various threads on this I have this on my page

 

<apex:page standardController="Booking_Sheet_Tick_Box__c" extensions="BookingSheetExtension">

 

Then I have an apex class BookingSheetExtension

 

public class BookingSheetExtension
{
	// Class variables
	...
	private final Booking_Sheet_Tick_Box__c bookingSheetObj;
	
	// Constructor	
	public BookingSheetExtension( ApexPages.StandardController controller )
	{
		this.bookingSheetObj = ( Booking_Sheet_Tick_Box__c )controller.getSubject();
		this.apiGetBookingSheet();
	}

	...

}

 I can open the page by typing in the url and it works fine. But it won't appear as a Content Source for my custom links and buttons.

 

 

Second problem

I gave up on this and just used Content Source = URL then put "/apex/My_Page?....." in the editor field. That works, to an extent, but now I can't get it to add in a value from a lookup field.

 

I'm adding the link to a custom object Procedure__c. In Procedure__c I have a Lookup to another custom object Procedure_Type__c (this has to be an object bttw, I can't just use a picklist)

 

I want the link to grab one of the fields from Procedure_Type__c for my custom link but it isn't being populated in the link

 

This is what I actually have in the editor field "/apex/Booking_Sheet?procedure_type_id={!Procedure_Type__c.External_Type_Id__c}"

 

and that opens up the page with the url "http://[salesforce.url]/apex/Booking_Sheet?procedure_type_id="

 

I've checked the objects that I'm using and they are all in the Procedure lookup, and they have a value for External_Type_Id__c

 

Does anyone have any ideas on what I could be doing wrong? I'm mostly interested in problem 2, but it would be nice to get problem 1 sorted out as well.

 

Thanks,

Mike

 

 

 

This isn't really a visualforce question, but someone may be able to shed some light.

 

I've setup a trigger to call a webservice callout, that updates my external application when I create new salesforce records.

 

In the callout code I'm having problems with the HttpRequest method setCompressed( true );

 

If I don't use this then my webservice will handle the POST I make fine (its a REST service btw), 

 

When I do use it to gzip the request, I don't know what I need to do to decompress / deflate the content on my external server.

 

(The webservice is built in cakephp on a LAMP stack )

 

I have apache setup to gzip the pages it serves, so do I need to tell it to decompress the request, if so how do I do that?

Is the decompression something I should I get php to do instead, in which case how can I get the compressed content to decompress into (I assume) the $_POST variable?

 

Thanks for any help you can give,

Mike

I'm trying to get accounts from our external system to load into salesforce via a webservice.

 

I've added a custom field to the Account object and set it as a unique external id.

 

I'm parsing the xml from the webservice and creating a List of Account objects to use in an upsert. The problem is that any account that has already been added throws a duplicate error when I try to upsert the list. I was hopig that it would recognise that the record existed and switch to an update.

 

I have also tried to do an upsert within the loop (instead of creating a list then upserting the whole list ofter the loop.)

 

here is a simplified version of my code

 

insertAccounts = new List<Account>();
if( this.theXMLDom != null )
{
if( this.theXMLDom.getElementByTagName( 'request_content' ) != null )
{
XmlDom.Element xmlRequestContent = this.theXMLDom.getElementByTagName( 'request_content' );
XmlDom.Element[] xmlHospitalList = xmlRequestContent.getElementsByTagName( 'hospital' );
if( xmlHospitalList != null )
{
for( XmlDom.Element xmlHospital : xmlHospitalList )
{
Account tmpAccount = new Account();

tmpAccount.Name = xmlHospital.getAttribute( 'name' );
tmpAccount.OpskwanAccountNumber__c = xmlHospital.getAttribute( 'account_number' );

// either add to a list or upsert individually
insertAccounts.add( tmpAccount );
//upsert tmpAccount;
} } } // upsert a list
upsert insertAccounts;
}

I suspect that the problem is that by doing this

Account tmpAccount = new Account();

I am creating a new Account object, with a new Id. So the upsert treats it as a separate record that needs to be inserted rather than checking against the current records for an existing record with a matching OpskwanAccountNumber__c.

 

Am I going to have to do the check against the existing accounts manually? or is there another way to create a list of Account objects which will work properly with upsert?

 

Thanks for the help,

Mike

I have this code on my page

 

 

<apex:dataTable value="{!Procedures}" var="Procedure" id="procedure-index" styleClass="list">
	...
	<apex:outputText value="{!AccountName(Procedure.Account__c)}"/>
	...
</apex:dataTable>

 

 

and this in my controller

 

public String getAccountName( Id accountId )
{
	Account tmpAccount = new Account();
	tmpAccount = [ select Name from Account where Id = :accountId ];
	return tmpAccount.Name;
}

 

but when I save I keep getting this error

"Save error: Unknown function AccountName. Check spelling.    procedures.page    /Opskwan/src/pages    line 0    Force.com save problem"

 

I've tried a few different things out to get it working with no luck and have come to the conclusion that there is something fundamental that I don't know.

 

Can anyone help me with this.

 

Thanks

Mike

I have been building an app on cakephp for a couple of years now, and have decided to build a salesforce version of it. The salesforce app will nee to use the external data. Is the following the best approach to use?

 

Create a webservice (I'm going with REST) on the external database.

 

Create custom 'Model' objects for each database table in a salesforce app.

 

Create all the page controllers but get them to pull data from and send data to the webservice.

 

If this is correct, will creating the custom objects start to build a salesforce database? I'm not sure I need that as there will be customers who don't have salesforce accounts, so the salesforce database will never be "complete". So if that is the case can I unhook custom objects fromthe salesforce database and have them only use the external database via the REST webservice.

 

Thanks for any advice,

Mike

 

 

I have setup a REST API on an external application. I'm trying to use it to display information in force.com.

 

The XML returned is similar to this

<procedures>
    <procedure id="201011201" distribution_centre_id="2" hospital_id="143" date_booked="2011-01-25 00:00:00">
        <procedure_sales id="9892" procedure_id="201011201" person_id="212">
        </procedure_sales>
        <procedure_surgeon id="9893" procedure_id="201011201" person_id="580">
        </procedure_surgeon>
    </procedure>
    <procedure id="201012022" distribution_centre_id="2" hospital_id="152" date_booked="2011-01-12 00:00:00">
        <procedure_sales id="10042" procedure_id="201012022" person_id="199">
        </procedure_sales>
        <procedure_surgeon id="10043" procedure_id="201012022" person_id="1013">
        </procedure_surgeon>
    </procedure>
</procedures>

 

I'm trying to get it to output this basic data in html something like this to start

 

<div><p>Procedure Id : 201011201</p><p>Surgeon Id : 9893</p></div>

<div><p>Procedure Id : 201012022</p><p>Surgeon Id : 10043</p></div>

 

On my page I have this

 

 <apex:outputText value="{!Procedures}" escape="false"/>

 

and in my controller I have this method

 

 public String getProcedures() {
    
        String procedureString = '';
        
        if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('procedure') != null) {
            
            XmlDom.Element[] procedures = this.theXMLDom.getElementsByTagName('procedure');
            
            if( procedures != null ) {
                procedureString =+ '<div>Procedures</div>';
                for( XmlDom.Element procedure : procedures ) {
                    procedureString =+ '.';
                    procedureString =+ procedure.getValue('id');
                }
            }
        }
        return procedureString;
    }

 

I was hoping that would give me this output

<div>Procedures</div>.201011201.201012022

 

but I only get this

<div>Procedures</div>

 

how can I loop though the xml nodes and to get at the data?

 

(I'm using the XMLDom class)

 

Thanks for any help.

Mike

 

 

I have a salesforce app that relies heavily on an external php application which is hosted on Amazon an Amazon EC2 instance.

 

I'd like to take advantage of the Amazon Simple Queue Service to send and receive all the data the 2 web services and exchanging. Amazon provide a php library I can use on my external app, but I'm going to need to implement it on force.com as well.

 

Has anyone had a look at using this service with force.com?

Does salesforce offer a similar service that I should look at using instead?

 

Thanks

Mike

I'm trying to get accounts from our external system to load into salesforce via a webservice.

 

I've added a custom field to the Account object and set it as a unique external id.

 

I'm parsing the xml from the webservice and creating a List of Account objects to use in an upsert. The problem is that any account that has already been added throws a duplicate error when I try to upsert the list. I was hopig that it would recognise that the record existed and switch to an update.

 

I have also tried to do an upsert within the loop (instead of creating a list then upserting the whole list ofter the loop.)

 

here is a simplified version of my code

 

insertAccounts = new List<Account>();
if( this.theXMLDom != null )
{
if( this.theXMLDom.getElementByTagName( 'request_content' ) != null )
{
XmlDom.Element xmlRequestContent = this.theXMLDom.getElementByTagName( 'request_content' );
XmlDom.Element[] xmlHospitalList = xmlRequestContent.getElementsByTagName( 'hospital' );
if( xmlHospitalList != null )
{
for( XmlDom.Element xmlHospital : xmlHospitalList )
{
Account tmpAccount = new Account();

tmpAccount.Name = xmlHospital.getAttribute( 'name' );
tmpAccount.OpskwanAccountNumber__c = xmlHospital.getAttribute( 'account_number' );

// either add to a list or upsert individually
insertAccounts.add( tmpAccount );
//upsert tmpAccount;
} } } // upsert a list
upsert insertAccounts;
}

I suspect that the problem is that by doing this

Account tmpAccount = new Account();

I am creating a new Account object, with a new Id. So the upsert treats it as a separate record that needs to be inserted rather than checking against the current records for an existing record with a matching OpskwanAccountNumber__c.

 

Am I going to have to do the check against the existing accounts manually? or is there another way to create a list of Account objects which will work properly with upsert?

 

Thanks for the help,

Mike

I have this code on my page

 

 

<apex:dataTable value="{!Procedures}" var="Procedure" id="procedure-index" styleClass="list">
	...
	<apex:outputText value="{!AccountName(Procedure.Account__c)}"/>
	...
</apex:dataTable>

 

 

and this in my controller

 

public String getAccountName( Id accountId )
{
	Account tmpAccount = new Account();
	tmpAccount = [ select Name from Account where Id = :accountId ];
	return tmpAccount.Name;
}

 

but when I save I keep getting this error

"Save error: Unknown function AccountName. Check spelling.    procedures.page    /Opskwan/src/pages    line 0    Force.com save problem"

 

I've tried a few different things out to get it working with no luck and have come to the conclusion that there is something fundamental that I don't know.

 

Can anyone help me with this.

 

Thanks

Mike

I have been building an app on cakephp for a couple of years now, and have decided to build a salesforce version of it. The salesforce app will nee to use the external data. Is the following the best approach to use?

 

Create a webservice (I'm going with REST) on the external database.

 

Create custom 'Model' objects for each database table in a salesforce app.

 

Create all the page controllers but get them to pull data from and send data to the webservice.

 

If this is correct, will creating the custom objects start to build a salesforce database? I'm not sure I need that as there will be customers who don't have salesforce accounts, so the salesforce database will never be "complete". So if that is the case can I unhook custom objects fromthe salesforce database and have them only use the external database via the REST webservice.

 

Thanks for any advice,

Mike

 

 

I have setup a REST API on an external application. I'm trying to use it to display information in force.com.

 

The XML returned is similar to this

<procedures>
    <procedure id="201011201" distribution_centre_id="2" hospital_id="143" date_booked="2011-01-25 00:00:00">
        <procedure_sales id="9892" procedure_id="201011201" person_id="212">
        </procedure_sales>
        <procedure_surgeon id="9893" procedure_id="201011201" person_id="580">
        </procedure_surgeon>
    </procedure>
    <procedure id="201012022" distribution_centre_id="2" hospital_id="152" date_booked="2011-01-12 00:00:00">
        <procedure_sales id="10042" procedure_id="201012022" person_id="199">
        </procedure_sales>
        <procedure_surgeon id="10043" procedure_id="201012022" person_id="1013">
        </procedure_surgeon>
    </procedure>
</procedures>

 

I'm trying to get it to output this basic data in html something like this to start

 

<div><p>Procedure Id : 201011201</p><p>Surgeon Id : 9893</p></div>

<div><p>Procedure Id : 201012022</p><p>Surgeon Id : 10043</p></div>

 

On my page I have this

 

 <apex:outputText value="{!Procedures}" escape="false"/>

 

and in my controller I have this method

 

 public String getProcedures() {
    
        String procedureString = '';
        
        if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('procedure') != null) {
            
            XmlDom.Element[] procedures = this.theXMLDom.getElementsByTagName('procedure');
            
            if( procedures != null ) {
                procedureString =+ '<div>Procedures</div>';
                for( XmlDom.Element procedure : procedures ) {
                    procedureString =+ '.';
                    procedureString =+ procedure.getValue('id');
                }
            }
        }
        return procedureString;
    }

 

I was hoping that would give me this output

<div>Procedures</div>.201011201.201012022

 

but I only get this

<div>Procedures</div>

 

how can I loop though the xml nodes and to get at the data?

 

(I'm using the XMLDom class)

 

Thanks for any help.

Mike

 

 

Hi there,
 
Apologies if this has been dealt with before (but i'm relatively new to Force.com IDE).
 
I've installed a free AppExchange application (Quote Line Items by Salesforce Labs). When I "refresh from server" in Eclipse, the application shows up in its own folder for my salesforce developer org project. So far, so good....
 
I've made changes to some of the s-Controls. I can deploy those changes and, again, everything is fine....
 
I can make changes (ie add new Custom Fields) to some of the (custom) objects in this application WITHIN THE SALESFORCE BROWSER. However, when I refresh from the server, I do NOT see the changes reflected in *__c.object file (within Eclipse). If I try to make the change the other way around (by modifying the package.xml and *__c.object file, and then click "Save" I then get a message "Cannot add new entity into an installed package" and have to roll those changes back to make everything ok again..
Is there anybody that has experienced the same thing, or someone that can help?
 
Regards
 
Dermot