• Vorno
  • NEWBIE
  • 25 Points
  • Member since 2007

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

Hi all,

 

I'm using getUrl to help redirect users after they post (upsert) data through a controller. However, when the page refreshes, the URL string contains all sorts of weird data (acutally, the post data itself). Any ideas about how to cleanse this out, and only return the URL string, e.g.,

 

https://c.cs2.visual.force.com/apex/CTN_Lessons_12  

 

instead of

 

https://c.cs2.visual.force.com/apex/CTN_Lessons_12?apprenticeshipId=a0GR000000190tPMAQ&com.salesforce.visualforce.ViewStateCSRF=.81nmB5NLIKSowfGW68Ozh1YbfyQRA_PK9vLzSMZ3B_DbvoIIPncNlNIIPA6744H7JTmluAAQsrSYvwoegMBZ.aPpHdlcZMSZmDIIi2y05XT7rqH4KEw6M2yM8vez7ChXCXnKw8lY0REsEIBobzuEt2hXVY%3D&ctContactId=003R000000Ea03n&id=a0eR0000000IqirIAC&j_id0%3Aj_id13=j_id0%3Aj_id13&j_id0%3Aj_id13%3AActivity_1__c=asdads&j_id0%3Aj_id13%3AActivity_1_Time__c=&j_id0%3Aj_id13%3AActivity_2__c=asdads&j_id0%3Aj_id13%3AActivity_2_Time__c=&j_id0%3Aj_id13%3AActivity_3__c=&j_id0%3Aj_id13%3AActivity_3_Time__c=&j_id0%3Aj_id13%3AAgenda=tst&j_id0%3Aj_id13%3ACollege_Career=asdasd&j_id0%3Aj_id13%3ACT_Introduction__c=&j_id0%3Aj_id13%3ACT_Introduction_Time__c=&j_id0%3Aj_id13%3ADebrief_Questions__c=&j_id0%3Aj_id13%3ADebrief_Questions_Time__c=&j_id0%3Aj_id13%3Aj_id15=j_id0%3Aj_id13%3Aj_id15&j_id0%3Aj_id13%3AMaterials=asdasd&j_id0%3Aj_id13%3AObjectives=test&j_id0%3Aj_id13%3ARitual=&j_id0%3Aj_id13%3ARitual_Time__c=&j_id0%3Aj_id13%3AWOW_em__c=&j_id0%3Aj_id13%3AWOW_em_Time__c=?apprenticeshipId=a0GR000000190tPMAQ 

 

...?

 

Here's my code:

 

 

public PageReference save() { PageReference pageRef = System.currentPageReference(); url = pageRef.getUrl(); try{ if (pageRef.getParameters().get('lessonNumber') != null) { lessonplan.Lesson_Number__c = pageRef.getParameters().get('lessonNumber'); } lessonplan.Name = 'Web Submission'; lessonplan.Apprenticeship__c = pageRef.getParameters().get('apprenticeshipId'); lessonplan.Last_CT_Modified__c = pageRef.getParameters().get('ctContactId'); upsert(lessonplan); }catch(Exception e){ String myErr = '?err=' + e.getMessage(); PageReference ref = new PageReference('/apex/testerr' + myErr); ref.setRedirect(true); return ref; } // url = '/apex/CTN_Lessons_12'; lessonid = lessonplan.id; apprenticeshipId = pageRef.getParameters().get('apprenticeshipId'); ctContactId = pageRef.getParameters().get('ctContactId'); urlstring = url + '?apprenticeshipId=' + apprenticeshipId + '&ctContactId=' + ctContactId + '&id=' + lessonid; // urlstring = url + '?id=' + apprenticeshipId + '&ctContactId=' + ctContactId; PageReference ref = new PageReference(urlstring); ref.setRedirect(true); return ref; }

 

 Thanks for your help!

 

Hi guys,

 

I'm trying to figure a way to get our dashboards to auto-refresh each night. Now, given we're running over 100 dashboards, using the Schedule Refresh option isn't an option.

 

Reading up on all of this, I can see there are a couple of javascript ways to trick the browser to issue a refresh on a given dashboard. A little hacky, but seems to be the only way so far I can find.

 

Now I was thinking of using a Http request from Apex to call the "refresh" Url, and hoping Salesforce would issue the refresh (and not be overly worried that the request is not really a browser). I'll assume I need to include cookies and headers in my request with Session IDs and other authentication pieces before this can work. Has anyone used the Http and HttpRequest objects/methods in Apex to call SFDC itself (and managed to authenticate?)

 

Second concern is there is no simple way to query the Dashboards for a list of Dashboard Ids. Sadly, it looks like the only way around this is to define a custom Object, and steal the list of Dashboard Ids out of the Html source straight from Dashboard tab. Has anyone else figured a way to get/query dashboards in Apex?

 

I might try and build a prototype call in apex, and see if I can get the Http request to hit Salesforce and authenticate... but would dearly appreciate some advice if other devs have tried their hand at this before?

 

If successful, glad to share code/walk-through.

 

Cheers,

Vaughan Crole

 

  • December 03, 2009
  • Like
  • 0

Hi all,

 

I'm trying to build in apex code that calls out to an external web service, however I'm finding a lot of issues at each step, and am currently struggling to get past the current error.

 

Current error is:

 

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://schemas.datacontract.org/2004/07/National.NonTraded.ReturnCalculator.Data=Error

Now this is all well and good, however I'm unable to get ahold of the SOAP request and response made/received from the WebServiceCallout class (defined in the classes build by WSDL2Apex).

 

I've read up that running the class/methods from Execute Anonymous within the Force IDE should give me this output - however I can't seem to get anything more than:

 

20090604033817.994:Class.PricingCentreReturnCalculator.BasicHttpBinding_IClientCentreService.DoRWACalculation: line 109, column 13: Sending callout request
20090604033817.994:Class.PricingCentreReturnCalculator.BasicHttpBinding_IClientCentreService.DoRWACalculation: line 109, column 13: Reading callout response

 

First question is, how can I enable the SOAP message output/debug, either in IDE or otherwise?

Second question is, given the limited knowledge of Web Services, is there any indication from the error this is more an Apex/code fault, a WSDL fault, or just the Web Service not behaving in a predictable fashion?

 

Any help much appreciated.

 

  • June 04, 2009
  • Like
  • 0

Hi all,

 

I'm trying to validate, for a given Opportunity (and associated Record Type), which sales stages are in the StageName picklist.

 

I've been able to query the OpportunityStage table, the RecordType table, and the BusinessProcess table, however there are no clear links between a OpportunityStage record and a BusinessProcess record.

 

Technically there should be another table that maps OppStageId to BusProcessId (many-to-many); are we able to access this through the API/Apex?

 

Cheers,

Vaughan

  • March 17, 2009
  • Like
  • 0
Is there any way to enable an Apex class to have an access level higher than the user running the class?

I'm trying to implement a class/button for users to add themselves into specific Account Teams, since they will need access ad hoc, but obviously can't insert the relevant record (via Apex) into the AccountTeamMember table for the Account, as they don't currently have access!

Any help appreciated

Cheers,
Vaughan Crole
  • August 25, 2008
  • Like
  • 0
Hey,

Having a problem updating an Account Name where an ampersand is present.

PHP is returning the following error:
Uncaught SoapFault exception: [soapenv:Client] The entity name must immediately follow the '&' in the entity reference.

Now I've tried escaping the ampersand (eg: \&) to no avail... Is there a way to use this character with PHP / Salesforce API ? Can I use Unicode or HTML encoding on this?
  • May 29, 2007
  • Like
  • 0
Just wondering about support for the new v8 API in PHP...  Is there a pre-release of the new PHP toolkit, or indeed, is Salesforce even writing one? Any timeline on it's release?

Currently we're using Person Accounts to co-ordinate our B2I records. All of our support scripts are written in PHP and I'm not overly keen on having to create a sub-set of these in JSP (or whatever).

-
Vaughan Crole


  • January 19, 2007
  • Like
  • 0
Ok, I'm currently playing around with the Workflow Outbound messaging, sending the messages to a PHP script. Using an old SF proof-of-concept, I'm reading the SOAP via the following: Code:
$data = fopen('php://input', 'rb');
$contents = stream_get_contents($data);
Now this is a pretty simplistic way of reading it, but it does work. Using regular expression, I can nab the Session ID and the Partner URL out of the $contents string, and this is all good and happy. Now comes the tricky part... Code:
    <sObject xsi:type="sf:Opportunity" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
     <sf:Id>00620000002clk0AAA</sf:Id>
    </sObject>
This is a small part of the SOAP message I've pinched from the $contents string also.

Now while it's easy to just collect the data in the tags, what I really want is to be able to stuff this into a sObject and get my field data through the object, so I won't need to use regex to collect every single field I need to work with one-by-one.

Anyone have any experience in this? A little demo code would be much appreciated.
  • January 16, 2007
  • Like
  • 0

Hi all:

Happy Holidays...

 

Basically something is wrong with my URL redirect that I keep getting the following error:

Attempt to de-reference a null object

 

 

public class newoppbutton { Contact contact{get;set;} public newoppbutton(ApexPages.StandardController stdController){ } public PageReference init() { String redirectUrl = ''; String recordTypeId = System.currentPageReference().getParameters().get('RecordType'); if (recordTypeId != null) { redirectUrl = '/006/e?retURL=/006/o&RecordType=' + recordTypeId + '&nooverride=1'; } else { // redirectUrl = '/006/e?nooverride=1'; redirectUrl = '/006/e?CF00N70000002RNNE='+contact.Name+'&nooverride=1'; } PageReference newOpp = new PageReference(redirectUrl); return newOpp; } } }

 Could someone tell me wz up with my code...or the correct URL to use for an user to go to a regular Opp page with the contact name filled in?

Thanks

 

 

Hi,

 

I know there have been some posts about this but none seem to suggest a working answer.

 

I'd like to be able to write a documents body directly to the browser and set the content type so that the contents are treated correctly by the browser.

 

So far I have for an image:-

apex: public string theBody {get; set;} public const(){ Document d = [select body from document limit 1]; theBody = d.EncodingUtil.base64encode(d.body); VF: ... <img src="data:image/jpeg:base64, {!theBody}"/>

...

 

 

Which works ok.

 

For a document e.g. application/msword this approach won't work.

 

I have tried writing out the body directly and body.toString() but none work (even with setting the contentType correctly). If the contentType is set then word just decides to open the data as text inside the document.

 

Has anybody managed this? Is it possible?

 

Thanks for any help.

 

R.

Hi all,

 

I'm using getUrl to help redirect users after they post (upsert) data through a controller. However, when the page refreshes, the URL string contains all sorts of weird data (acutally, the post data itself). Any ideas about how to cleanse this out, and only return the URL string, e.g.,

 

https://c.cs2.visual.force.com/apex/CTN_Lessons_12  

 

instead of

 

https://c.cs2.visual.force.com/apex/CTN_Lessons_12?apprenticeshipId=a0GR000000190tPMAQ&com.salesforce.visualforce.ViewStateCSRF=.81nmB5NLIKSowfGW68Ozh1YbfyQRA_PK9vLzSMZ3B_DbvoIIPncNlNIIPA6744H7JTmluAAQsrSYvwoegMBZ.aPpHdlcZMSZmDIIi2y05XT7rqH4KEw6M2yM8vez7ChXCXnKw8lY0REsEIBobzuEt2hXVY%3D&ctContactId=003R000000Ea03n&id=a0eR0000000IqirIAC&j_id0%3Aj_id13=j_id0%3Aj_id13&j_id0%3Aj_id13%3AActivity_1__c=asdads&j_id0%3Aj_id13%3AActivity_1_Time__c=&j_id0%3Aj_id13%3AActivity_2__c=asdads&j_id0%3Aj_id13%3AActivity_2_Time__c=&j_id0%3Aj_id13%3AActivity_3__c=&j_id0%3Aj_id13%3AActivity_3_Time__c=&j_id0%3Aj_id13%3AAgenda=tst&j_id0%3Aj_id13%3ACollege_Career=asdasd&j_id0%3Aj_id13%3ACT_Introduction__c=&j_id0%3Aj_id13%3ACT_Introduction_Time__c=&j_id0%3Aj_id13%3ADebrief_Questions__c=&j_id0%3Aj_id13%3ADebrief_Questions_Time__c=&j_id0%3Aj_id13%3Aj_id15=j_id0%3Aj_id13%3Aj_id15&j_id0%3Aj_id13%3AMaterials=asdasd&j_id0%3Aj_id13%3AObjectives=test&j_id0%3Aj_id13%3ARitual=&j_id0%3Aj_id13%3ARitual_Time__c=&j_id0%3Aj_id13%3AWOW_em__c=&j_id0%3Aj_id13%3AWOW_em_Time__c=?apprenticeshipId=a0GR000000190tPMAQ 

 

...?

 

Here's my code:

 

 

public PageReference save() { PageReference pageRef = System.currentPageReference(); url = pageRef.getUrl(); try{ if (pageRef.getParameters().get('lessonNumber') != null) { lessonplan.Lesson_Number__c = pageRef.getParameters().get('lessonNumber'); } lessonplan.Name = 'Web Submission'; lessonplan.Apprenticeship__c = pageRef.getParameters().get('apprenticeshipId'); lessonplan.Last_CT_Modified__c = pageRef.getParameters().get('ctContactId'); upsert(lessonplan); }catch(Exception e){ String myErr = '?err=' + e.getMessage(); PageReference ref = new PageReference('/apex/testerr' + myErr); ref.setRedirect(true); return ref; } // url = '/apex/CTN_Lessons_12'; lessonid = lessonplan.id; apprenticeshipId = pageRef.getParameters().get('apprenticeshipId'); ctContactId = pageRef.getParameters().get('ctContactId'); urlstring = url + '?apprenticeshipId=' + apprenticeshipId + '&ctContactId=' + ctContactId + '&id=' + lessonid; // urlstring = url + '?id=' + apprenticeshipId + '&ctContactId=' + ctContactId; PageReference ref = new PageReference(urlstring); ref.setRedirect(true); return ref; }

 

 Thanks for your help!

 

Hi,

I've built a matrix of PageBlockTables with a bunch of values in the columns and the totals in the header. Now for the problems:
  • How do I format the header? None of my efforts to get the column header to align on the right hand side of the column has had any effect.
  • How do I display a currency symbol in the header?
Code:
<apex:facet name="header">&euro;{!totalCAssets}</apex:facet>
OR 
<apex:column style="text-align:right" headerstyle="text-align:right" width="25%" headerValue="&euro;{!totalCAssets}">

didn't work. It simply displays the string "&euro;

Still trying to work out a few other issues I'm experiencing, but those would be a great help already!

Thanks for your help!
Marc

Hey,

Having a problem updating an Account Name where an ampersand is present.

PHP is returning the following error:
Uncaught SoapFault exception: [soapenv:Client] The entity name must immediately follow the '&' in the entity reference.

Now I've tried escaping the ampersand (eg: \&) to no avail... Is there a way to use this character with PHP / Salesforce API ? Can I use Unicode or HTML encoding on this?
  • May 29, 2007
  • Like
  • 0
Just wondering about support for the new v8 API in PHP...  Is there a pre-release of the new PHP toolkit, or indeed, is Salesforce even writing one? Any timeline on it's release?

Currently we're using Person Accounts to co-ordinate our B2I records. All of our support scripts are written in PHP and I'm not overly keen on having to create a sub-set of these in JSP (or whatever).

-
Vaughan Crole


  • January 19, 2007
  • Like
  • 0