-
ChatterFeed
-
9Best Answers
-
0Likes Received
-
0Likes Given
-
20Questions
-
85Replies
Select Options available through API
If we have a field that is a drop down in Salesforce is it possible to retrieve a list fo all of the available values through the API?
- Matt Briney
- November 23, 2011
- Like
- 0
- Continue reading or reply
Can't access custom contact field in Opportunity using the API.
I've created a Opportunity Contact field for Opportunity which is a lookup on the Contact table.
From salesforce I can see the contact and work with it and everything looks happy.
But when trying to access the contacts information using PHP I get nothing. I'm using the following code:
$queryOpportunity = "Select AccountId, Amount, Paid__c, Opportunity_Contact__c from Opportunity WHERE Id = '$id'" ; $OppResponse = $mySforceConnection->query(($queryOpportunity)); foreach ($OppResponse->records as $OppRecord) { $subtotal = $OppRecord->Amount ; $email = $OppRecord->Opportunity_Contact__c->Email ; var_dump($OppRecord) ; var_dump($OppRecord->Opportunity_Contact__c) ;
And I can't get any of the information for the contact. Help.
Also, Instead of grabbing the AccountID and doing a seperate query on account is there anyway to just grab the account information with this query as well?
- Thrantor
- May 27, 2010
- Like
- 0
- Continue reading or reply
Format datetime for display in PHP
Hi,
This must be really simple because I can't find any example of how to do this. All I want to do is make my datetimes look nice. Here is what I get out of my query results object:
2009-09-04T06:43:36.000Z
And I would like to format it like this:
09/04/2009, 12:43 PM
Can anyone clue me in?
- ssuede7
- September 04, 2009
- Like
- 0
- Continue reading or reply
How do you update a field to null?
Here is basically what I do.
$sObject1 = new SObject();
$sObject1->fields = $fieldsToUpdate;
$sObject1->type = 'Lead';
$sObject1->Id = $record->Id;
$response = $mySforceConnection->update(array ($sObject1));
This works great until I change a value to null. :)
- LarryKreeger
- September 02, 2009
- Like
- 0
- Continue reading or reply
Create a PHP script to pull records from SalesForce into MySQL
- Dumo
- August 11, 2009
- Like
- 0
- Continue reading or reply
Limited Queries?
I run the query
SELECT Id,LastName,FirstName FROM Account
and only about a 1000 records are called?
Why is this.. I need to call all of them. Is there a way of leap frogging in soql?
SELECT Id,LastName,FirstName FROM Account LIMIT 10,200
and find the number of rows in the query?
- zeezackisback
- April 29, 2009
- Like
- 0
- Continue reading or reply
Simulating a custom button / link in a VF Page?
Currently... on my case layout I have a custom link which calls an custom S-Control with the behavior
of Display in new window (ie.. popup) This s-control simply builds a bunch of querystring parms and changes the window's location to an external app passing these parms and then I'm good.
I have built a new VF page and I want to add the same functionality that custom link is providing on that standard case page.
Is there a way in VF to.............
1. reference this custom link and "drop it" on the page so as I can reuse all the existing code. (I don't think so)
2. maybe utilize a commandLink (I don't need a server side action called) and then in the onclick of the command link somehow tell it to utilize the existing custom s-control and popup a new window with specific height / width.. etc.???
The more I think about this the more I know I'm thinking about this all wrong!!! :)
Any help would be appreciated!!
Thanks
- sf consultant.ax380
- August 26, 2008
- Like
- 0
- Continue reading or reply
Can't log into Force.com Explorer
I'm trying to log into a production edition and keep getting this error:
Login failed: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
I know my username, password and security token are all working because I'm logging in with the IDE and I'm not locked out. The login attempts are not showing up in the Login History at all.
Anyone know what the issue is?
I'm using v0.58A with Adobe Air v3.1.0.4880.
- ptepper
- March 06, 2012
- Like
- 0
- Continue reading or reply
Best practices for caching data (JSON) retrieved via web service callout from Apex?
Hi,
I have some code that gets some JSON data from a web service callout, then parses it into a collection (map) or object. I'm wondering if there's a best practice or method people are using to then cache this data for some amount of time so that it's not being retrieved and parsed everytime it is needed.
I'm thinking I can create an custom object for this and store the data there, either in a structured format, or serialize it to a JSON string and then store the whole string. I'd store it with a timestamp so that I know when to refresh it.
Is there a better way to do this? And by better I mean recommended or faster?
thanks
- ptepper
- January 09, 2012
- Like
- 0
- Continue reading or reply
Finding line number to go with error message
I got a "List has no rows for assignment to SObject An unexpected error has occurred. Your development organization has been notified." error message. I know what this error message generally means, but I don't know what the offending line(s) are. It's happening in my production environment, but not in my Sandbox, and I think it has something to do with some fields being populated in the Sandbox, but they're not in the Production so a query is failing somewhere.
Is there a way to determine what lines of what class are causing the problem (line numbers)?
thanks
- ptepper
- November 03, 2011
- Like
- 0
- Continue reading or reply
Accessing class functions and variables from RemoteAction function
Hi,
I'm trying to access a class function from a RemoteAction function.
The function I was trying to access is not static, while the RemoteAction function must be static. This causes the "Method does not exist or incorrect signature" error.
So I changed the function I was calling to be static, which gets rid of that error. But that creates a new error, because the function is trying to call an instance variable which is not static - "Variable does not exist". Addiing static to that variable does not change anything.
Something like this:
global with sharing class MyClass { public static String myVar {get;set;} public static void myClassFunction(String id){ myVar = ''; } @RemoteAction global static string updateRecord(String id){ myClassFunction(id); return '1'; } }
What's the right way to do this?
- ptepper
- October 21, 2011
- Like
- 0
- Continue reading or reply
Outline and bookmarks not working in eclipse Force.com IDE
When working in the Force.com IDE, the contents of my Outline view keep disappearing, with nothing inside the window. It's a pretty important feature of an IDE, so it's pretty annoying.
I've been trying to use Bookmarks as a workaround, but regularly after a I save, my booksmarks all get cleared!
So there's a clearly bugs with both the Outline and Bookmarks in eclipse, at least with the Force.com IDE.
Has anyone else had this problem? Anyone know how to solve it?
It's a pain to navigate code using line numbers and 'Find' alone.
thanks
- ptepper
- August 12, 2011
- Like
- 0
- Continue reading or reply
RemoteAction returns long number for date in Javascript Result - how to I convert to readable date?
I'm returning a query result as an SObject from a RemoteAction method in Apex that includes an ActivityDate field on it, which should be type date. When I get it in the Javascript it's a long number like 1312848000000.
I'm guessing this is some internal storage format, but I don't think it's a normal Unix timestamp. Can someone tell me how to convert this to a readable date string, either in the Javascript or the Apex?
thanks
- ptepper
- August 10, 2011
- Like
- 0
- Continue reading or reply
Weird behavior with triggers preventing deployment of a separate class
I have a class I'm updating on my Sandbox (a VF custom controller). There are several triggers in this sandbox, each of which has a corresponding class with a a test method in it.
In Eclipse, when I right click the one class I want to deploy and deploy to server I get a failure, it says because of the triggers:
Code coverage issue, class: Trigger1 -- Test coverage of selected ApexTrigger is 0%, at least 1% test coverage is required
Code coverage issue, class: Trigger2 -- Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
Code coverage issue, class: Trigger3 -- Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
Code coverage issue -- Average test coverage across all Apex Classes and Triggers is 70%, at least 75% test coverage is required
However, all of these triggers have 100% coverage by the corresponding classes. I'm just selecting the one class I want to deploy, not the other classes with the triggertest methods.
I managed to get it to deploy by selecting the whole 'classes' folder in Eclipse. The first time I did this, all the triggers and other classes now showed that they pass the unit tests, but the class I was trying to deploy did not. I looked in the logs and it said it was because of a "System.Exception: Too many query rows". So I changed the code so that there were limits in my queries (there were no limits before, and it used to work).
When I changed that, then selected the 'classes' folder and delpoyed, it deployed fine.
Anyone know why there is this weird behavior? Why does it tell you your triggers are failing and your class to deploy is passing, when that is not the case? It was this other error all along, but I had to deploy the folder to see it. Is this a bug?
Sorry if the solution to this is posted elsewhere, but I can't find it.
thanks,
-paul
- ptepper
- January 29, 2010
- Like
- 0
- Continue reading or reply
Querying master-detail / related list with SOQL
Hello,
I have a custom object I use for data about events at my organization MyEvent__c, and a connector object for tracking RSVPs to the events, RSVP__c.
I'm trying to query the RSVPs but can't seem to get a query to work. The RSVP__c object connects to the event object with a Master-Detail(Event) field.
I'm trying to test queries with the Apex Explorer and I can't get the most basic SOQL queries to work:
Select Id from RSVP__c
Returns Error: Query failed: INVALID_TYPE: sObject 'RSVP__c' is not supported.
Select e.Id,e.Event_Title__c, (Select Id,Name from RSVP__r) from MyEvent__c e where e.Id = 'a0A7xxxxxxxxxxx'
(with a valid id in there) returns error:
Query failed: INVALID_TYPE ... (query)
ERROR at Row:1:Column:52
Didn't understand relationship 'RSVP__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
The WSDL has the relationship in there in the MyEvent__c object:
<element name="RSVP__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>
I have no idea why this is not working. My guess is that it's a permissions thing or a namespace thing, but I don't know.
Any help would be greatly appreciated.
Thanks,
-paul
- ptepper
- January 25, 2010
- Like
- 0
- Continue reading or reply
Dynamic Custom List Button Behavior Based on Current View
Hi,
I'm working on an application where I'd like to have a custom List Button do something different based on the currently selected list view. I have a Visualforce page that does a dynamic query and I'd like to retrieve the current view name or ID to use in this query, which I would send to the VF page by adding it as a param in the URL of the VF page called by the custom list button.
The current view is identified with a URL GET param like this:
https://nan.salesforce.com/aXX?fcf=00NN000000NNnNN
The fcf param specifies the current view by ID (=00NN000000NNnNN). Is there a way to get that fcf param or maybe the title of the name of the current view and pass it in a link to a VF page in a custom button?
In Apex, you can use getParameters to get that GET param, but in the custom button, I don't think it's possible to do it that way, because it's a PageReference method and this isn't a Visualforce page
I can get the params from the current URL with Javascript (window.location.search) and then parse it out of there in an OnClick function, which works fine (that's how I'm doing it now), but I wanted to check to see if anyone knows of a better way to do it besides hardcoding it into the JS.
Alternatively, I'm considering scrapping the built-in list view altogether and making a VF view to replace it, which would also solve the problem.
thanks,
-paul
- ptepper
- September 08, 2009
- Like
- 0
- Continue reading or reply
Java-like Reflective Field Access in Apex?
In Java you can access a class's fields using the reflective method getField(String name). Is something like this possible in Apex?
For example, instead of accessing with simple dot notation:
String lname = Contact.lastName;
Is there a way to do something like this:
String lname = Contact.getField('lastName');
I'm trying to access a field where I'm pulling the field name from a variable, but I obviously can't do something like.
String.myVar = "lastName";
String lname = Contact.myVar;
I can set this up with a block of if statements (like a switch statement), but if there's a way to do it with reflection, that seems more elegant to me. I'm going to be testing for a lot of values so it would certainly be more concise (1 line of code vs n lines, where n is the number possible values).
if(myVar == "lastName" ) {lname = Constant.lastName}
I'm guessing the answer is no, because I don't see it in the manual...
-paul
- ptepper
- August 03, 2009
- Like
- 0
- Continue reading or reply
TinyMCE breaks Javascript Insert from Lookup Popup Window
For anyone looking into using TinyMCE in a VF page: it breaks the Salesforce functionality for lookup fields to paste a selected value from the lookup popup window.
More specifically the function that occurs when you click a magnifying glass next to a lookup inputField, it launches a popup from which you can search and select a record. If the TinyMCE script is loaded I get this error logged in Firebug:
function onclick(event) {
- ptepper
- October 21, 2008
- Like
- 0
- Continue reading or reply
Customizing Built-in (FCKeditor) Rich Text Editor in Winter '09
I started a thread on this a while ago about this and didn't really get anywhere, but it seems like a new one can be started for Winter 09, since it looks like the Dojo rich-text editor that was available in Summer 08 has been replaced with FCKeditor in Winter 09.
Still wondering about the same question- does anyone know if it's possible to configure and customize this editor? But now I'm hoping there will be an answer since the editor has been changed.
In particular, there's an option for
FCKConfig.ForcePasteAsPlainText = true ;
that I would really like to use, because otherwise my users can paste all kinds of messy text formatting in there. In the default setup it's set to false.
I tried just inserting it between <script> tags but that doesn't work.
Thanks,
-paul
- ptepper
- October 20, 2008
- Like
- 0
- Continue reading or reply
Rich Text editor disabled? Working in Sandbox, not in production server
Anyone know if the Dojo rich text editor for input textareas has been disabled? That's the one that shows up when you set the richtext attribute to true. It has stopped working in my Production server, but it is still working in my sandbox.
I noticed that in the developer server Firebug catches 2 errors, neither of which show up in my sandbox:
dojo.render is undefined
dojo.js line 492
var drh=dojo.render.html;
and
servletIntegration?lid=01N7[...]
this.lookupInput.onkeyup = AutoComplete.prototype.onKeyUp;
thanks,
-paul
Message Edited by ptepper on 09-10-2008 12:49 PM
- ptepper
- September 09, 2008
- Like
- 0
- Continue reading or reply
Inconsistent Cross-Browser Behavior (IE7 & Firefox) for Visualforce Page & Buttons
I'm working on a Visualforce page with it's own tab and getting inconsistent behavior from IE7 & Firefox (both v2 & 3). I just need a link to another VF page, but I want it to look like a button because its a custom 'new item' button. So I'm using a commandButton, like this (my objects/functions have different names...):
<apex:pageBlock title="Section 1" id="section1">
<apex:pageBlockButtons >
<apex:commandButton action="{!newObject}" value="New Object" />
</apex:pageBlockButtons>
...
I have an Apex standard object controller extension with a function that just returns a page reference like this:
public PageReference newObject(){
PageReference pageRef = new PageReference('/apex/ObjectEdit');
pageRef.setRedirect(true);
return pageRef;
}
In Firefox it works perfectly, in IE it just reloads the current page and then jumps down to near the bottom of the page (reloads the page where the 'New Object' button is placed). Also, the commandButton gets rendered at the top and the bottom of the page block, in the pageblockButton sections, however in IE, the button in the bottom section doesn't work at all -- when you click it nothing happens.
Pretty drastic inconsistency -- basically the command button doesn't work at all in IE (works wrong on top and does nothing on bottom).
Any help would be greatly appreciated as I have a lot of IE users.
thanks,
-paul
- ptepper
- August 26, 2008
- Like
- 0
- Continue reading or reply
Incorrect Tab Style on Page with standardController & extension attributes set
I created a page where the apex:page declaration is something like this:
<apex:page standardController="MyObject__c" extensions="MyController" id="thePage" title="The title">
I have set up a tab color and icon for the tab settings on this object. The problem is that it usually loads an incorrect style, which I'm assuming is the default styling for a custom object. It has a purplish color (#747E96) and a multi-colored cube icon (https://na5.salesforce.com/img/icon/custom32.png). The weird thing is that it only happens sometimes -- sometimes it loads the correct colors and icon -- and I can't figure out what's causing it to happen sometimes but not all the time.
I've tried explicitly setting the tabStyle param (tabStyle="MyObject__c") but that doesn't change anything.
Any idea why this is happening?
thanks,
-paul
- ptepper
- August 25, 2008
- Like
- 0
- Continue reading or reply
Deploy Bug? Inconsistent unit test results in deployment validation & IDE test runner
I'm trying to deploy an Apex class (a Visualforce controller) with the Force.com IDE in Eclipse. When I run my unit tests with the Apex Code test runner, it says I have 76% coverage (17 lines not tested). The code runs fine with no errors and does everything it's supposed to.
But when I go to deploy the code, I get a failure message and a totally different 'Code Coverage' result. Here it says I have 11% coverage (64 lines not tested).
Does anyone know why I would have such drastically different results running the test code from the test runner vs. validating for deployment? Seems very strange, like a bug.
It also says I have an error which doesn't come up when I save or run the code:
System.QueryException: List has not rows for assignment to SObject.
The line in question is basically:
myObject1 = [select id, name, ... from MyObject__c];
Again, anyone know why this would be happening here but not when I save or run the code?
I'm wondering if there's some bug(s) in the Deploy to Server functionality in Apex. Will I get different results using the Force.com Migration tool? Anyone had similar problems?
thanks,
-paul
- ptepper
- July 29, 2008
- Like
- 0
- Continue reading or reply
System.Exception: DML currently not allowed ... External entry point
I'm trying to create a delete function for a custom object. In my Visualforce code, there's a link that goes to a new page with an object ID query parameter. The controller on that next page gets the id and tries to delete the object. I'm getting this error:
System.Exception: DML currently not allowed
Class.MyDeleteController.<init>: line .., column ..
External entry point
Anyone know why I might be getting this error and how to make this work? I would think that executing a delete function in Apex from Visualforce would be something pretty basic. I've tried executing the function multiple ways, by Id and with the object itself, with code like this:
Id id = ApexPages.currentPage().getParameters().get('id');
delete id;
(Database.delete(id) doesn't work either, same error)
MyObject obj = [select id, Name FROM MyObject__c WHERE id = :id];
delete obj;
(Database.delete(obj) doesn't work either, same error)
-paul
- ptepper
- July 23, 2008
- Like
- 0
- Continue reading or reply
Context-sensitive Bug in Accessing Components with their IDs?
<apex:page id="thePage">
<apex:pageBlock title="Title" id="mainBlock">
<apex:form id="theForm">
<p><a href='#' onclick='domtest()'>Test Link 1</a></p>
<p><a href='#' onclick="alert('{!$component.mySection.description}')">Test Link 2</a></p>
<apex:pageBlockSection title="My Section" id="mySection">
<apex:inputTextarea id="description" />
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
<script>
function domtest(){
alert('{!$component.mySection.description}');
}
</script>
</apex:page>
When you click on 'Test Link 2' the alert works fine, and displays the id of the element (thePage:mainBlock:theForm:mySection:description). But when you click 'Test Link 1', which executes the domtest() function, it just comes up blank/empty. Shouldn't the calling the Javascript function domtest() should do exactly the same thing, since it's exactly the same code as in the onclick attribute?
In Ron Hess's blog example, he uses a visualforce component reference in a script block:
http://wiki.apexdevnet.com/index.php/Building_a_Blogging_Application_Using_Visualforce
He does place the script block after the visualforce code, so I thought order might have something to do with it. I started with the script block right after the apex:page tag, and I've tried moving the script block around the page and it doesn't change anything.
I don't understand why the exact same code would work when in the onclick attribute but not when called through a function defined in a script block. Seems like a (pretty serious) bug to me. I got to this test because I haven't been able to reference any elements by Id successfully from a script block, which makes writing functions pretty useless.
Any help would be great.
-paul
- ptepper
- July 18, 2008
- Like
- 0
- Continue reading or reply
Customizing Built-in (Dojo) Rich Text Editor or Using external one
I'm trying to incorporate a rich text textarea into a Visualforce page. I tried using the richtext="true" attribute, but it seems like I don't have
very little control over the size and location of the textarea once it's rendered. This creates the rich text editor fine:
<apex:pageBlockSection collapsible="true" title="My Form"> <apex:inputField value="{!event.Field1__c}"/> <apex:inputTextarea value="{!event.Field3__c}" id="specialTextArea" richtext="true"/> <apex:inputField value="{!event.Field2__c}"/> </apex:pageBlockSection>
displays as wide as it can fit. I'm getting input for a SObject, so I'm using inputField elsewhere, but this seems to work as far as
getting input in and out goes -- it gets and saves the field data with no problem.
Unlike inputField though, this won't automatically generate a label, so I also tried something like this:
Label <apex:inputTextarea value="{!event.Field3__c}" id="specialTextArea" richtext="true"/>
But that doesn't work either -- it just pushes the rich textarea over to the right.
Has anyone had any luck using this inside a PageBlockSection amongst other inputFields?
I also tried a few other WYSIWYG packages that I used in other work -- TinyMCE and the WYMeditor plugin for jquery. However,
I was not able to get either to work in the visualforce page. Both require a class or id attribute to identify the textArea to make
rich text. Identifying class doesn't seem to work. I also tried using the id, but the id seems to get transformed in the output.
Looking at the source of the html frame, I see something like id="j_id0:j_id3:j_id4:j_id32:specialTextArea".
I also tried that id, but it didn't work either. If anyone has gotten another WYSIWYG editor working with visualforce, I'd be interested
in hearing about that also.
thanks,
-paul
Message Edited by ptepper on 07-09-2008 01:21 PM
- ptepper
- July 09, 2008
- Like
- 0
- Continue reading or reply
Apex generation from WSDL failed for Amazon AWS SimpleDB WSDL
Hi,
I'm trying to generate an Apex class from the WSDL file from Amazon AWS's SimpleDB web service:
http://sdb.amazonaws.com/doc/2007-11-07/AmazonSimpleDB.wsdl
The file parses fine, but then when I try to generate the Apex class I get this error message:
Apex generation failed.
Error message:
Error: Unable to find name for element in :ListDomainsResponse_element
Anyone know how to deal with this, or seen this before with other WSDL files?
I'm guessing it's a problem with the Apex generator, not the WSDL, because I don't see anything out of the ordinary in the WSDL.
I think I may be able to get around using SOAP since they offer HTTP REST services also, but it seems like the SOAP interface would be a better way to use the service.
thanks, -paul
Message Edited by ptepper on 06-23-2008 01:19 PMMessage Edited by ptepper on 06-23-2008 01:20 PM
- ptepper
- June 23, 2008
- Like
- 0
- Continue reading or reply
Perl API and custom objects - need to use enterprise WSDL?
Hi All,
Salesforce API newbie here.
Using Perl I can do basics on Accounts, Cases, Opportnuities, but when I try to access custom objects I run into trouble. For example trying to look up a custom object returns an error like:
INVALID_TYPE:
select id from Bugzilla__c where BZ_Number__c like '1234'
^
ERROR at Row:1:Column:16
sObject type 'Bugzilla__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at update-keywords-for-bug.pl line 185
I assume I need to reference my enterprise WSDL instead of the default (in my script I reference https://test.salesforce.com/services/Soap/u/23.0)
How do I do this in Perl? I have searched the forums here and find threads that touch on the topic but can't find any answers,
Help appreciated!
Thanks - James
- jcroall
- March 18, 2012
- Like
- 0
- Continue reading or reply
Problem with PHP SDK and expr0 functions
I am running into a problem with the PHP SDK and aggregate functions. We are trying to do a very simple calculation that counts the number of records by each MailingState. Our query is as follows:
$query = "SELECT MailingState, count(Contact.Id) from Contact WHERE MailingState != '' GROUP BY MailingState";
$response = $mySforceConnection->query($query);
When I run the PHP code on my local MAMP stack the $response array returns back properly with MailingState and the expr0 count. However when I run the same code on our remote webserver (Rackspace Cloud Sites), the $response array only shows the MailingState and does not return the aggregate calculation.
Has anyone run into this problem before? is there something that we should be looking for in the PHP config?
Thanks,
-Matt
- Matt Briney
- March 12, 2012
- Like
- 0
- Continue reading or reply
Can't log into Force.com Explorer
I'm trying to log into a production edition and keep getting this error:
Login failed: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
I know my username, password and security token are all working because I'm logging in with the IDE and I'm not locked out. The login attempts are not showing up in the Login History at all.
Anyone know what the issue is?
I'm using v0.58A with Adobe Air v3.1.0.4880.
- ptepper
- March 06, 2012
- Like
- 0
- Continue reading or reply
Accessing Custom Objects via PHP SOQL call
Using the SOQL commander I am able to query and retrieve values from fields within custom objects without issue.
When I try to use the same exact query from PHP I get "Notice: Undefined property: SObject::$Date_Requested__c in /var/www/........"
..... where date_requested__c is one of the custom fields I'm trying to pull.
How come I cannot retrieve values from the API like I can using the SOQL commander SQL dashboard?
Is querying custom fields from the API not allowed?
Thanks in advance,
Ryan
- ryandevito
- February 28, 2012
- Like
- 0
- Continue reading or reply
Best practices for caching data (JSON) retrieved via web service callout from Apex?
Hi,
I have some code that gets some JSON data from a web service callout, then parses it into a collection (map) or object. I'm wondering if there's a best practice or method people are using to then cache this data for some amount of time so that it's not being retrieved and parsed everytime it is needed.
I'm thinking I can create an custom object for this and store the data there, either in a structured format, or serialize it to a JSON string and then store the whole string. I'd store it with a timestamp so that I know when to refresh it.
Is there a better way to do this? And by better I mean recommended or faster?
thanks
- ptepper
- January 09, 2012
- Like
- 0
- Continue reading or reply
Pushing Salesforce data to a website's database
Hi everyone
I need to push data from salesforce (on an event) to a website.... if anyone of you have done some work like this, juss let me know....
Thanx in advance
- Vishal Gaddi6
- December 28, 2011
- Like
- 0
- Continue reading or reply
Select Options available through API
If we have a field that is a drop down in Salesforce is it possible to retrieve a list fo all of the available values through the API?
- Matt Briney
- November 23, 2011
- Like
- 0
- Continue reading or reply
sObject type is not supported when using custom objects in the PHP Soap API
Using the PHP API code... $theQuery = "Select s.TranscriptGrade__c, s.SystemModstamp, s.StudentID__c, s.StudentCourseID__c, s.SignatureGrade__c, s.ReceiptNumber__c, s.Project_ID__c, s.OwnerId, s.Name, s.Multi_Class_Project_id__c, s.LastModifiedDate, s.LastModifiedById, s.IsDeleted, s.Id, s.GradeDate__c, s.EvalPosted__c, s.CreditStatus__c, s.CreatedDate, s.CreatedById, s.ClientID__c From STUDENT_COURSE__c s Where s.ClientID__c='" . $theContactID . "'"; I am getting the error: Unexpected exception of type [SoapFault] with message [INVALID_TYPE: s.CreatedById, s.ClientID__c From STUDENT_COURSE__C s Where s.ClientID__c='' ^ ERROR at Row:5:Column:47 sObject type 'STUDENT_COURSE__C' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names Tried the same call using the Java Eclipse schema tool and the query succeeds so there seems to be an issue with the PHP API. We are developing our application with the requirement of using PHP so we would like to figure out a work around to this issue. Thanks, -Laura |
- lauraeci
- November 18, 2011
- Like
- 0
- Continue reading or reply
Finding line number to go with error message
I got a "List has no rows for assignment to SObject An unexpected error has occurred. Your development organization has been notified." error message. I know what this error message generally means, but I don't know what the offending line(s) are. It's happening in my production environment, but not in my Sandbox, and I think it has something to do with some fields being populated in the Sandbox, but they're not in the Production so a query is failing somewhere.
Is there a way to determine what lines of what class are causing the problem (line numbers)?
thanks
- ptepper
- November 03, 2011
- Like
- 0
- Continue reading or reply
Make a link not a link!
I have a search page for my custom object and in the result display the Member field (linked to Contact) is automatically clickable. I don't want this to be the case. Can I disable this?
The code for the section is:
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Member" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="member" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!counselling_practice.Member__c}"/>
</apex:column>
Thanks in advance
Justyn
- justyn
- November 02, 2011
- Like
- 0
- Continue reading or reply
Basic SOQL - Relationships instead of Joins:?
I know my question is going to be pretty simple for you veterans but can someone explain to me how relationships work in SOQL. I have looked at the documentation and the discussion boards but can not seem to understand it.
I want to get the following fields from the following tables:
Contact.FirstName,
Contact.LastName,
Account.Name,
Opportunity.Name
I have tried the following but it does not seem to work:
SELECT Contact__c.FirstName, Contact__c.LastName, Contact__c.Account__r.Name, Contact__c.Account__r.Opportunity__c.Name From Contact
The more I read the more confused I get.
I need to understand the basic concept. If someone could help I would appreciate it.
Robert
- RD7408
- October 21, 2011
- Like
- 0
- Continue reading or reply
Code Coverage on custom Exception classes, is it covered when there are no executable lines?
I have a simple custom exception class. Since it's referenced from more than one class, I did not make it an inner class. It is in a class all by itself that reads as below--
public class OppSyncException extends Exception { }
I have Apex tests that instantiate this exception. But when I look at the code coverate for that module it says 0%. Now it has 0 executable lines so technically coverage is undfined (0/0).
What I want to know is will I have a problem trying to deploy this module where it will complain that the coverage is < 75%?
- Ken Koellner
- October 21, 2011
- Like
- 0
- Continue reading or reply
Make field display if not null
<b>12. Purchase Order #: </b><apex:outputfield value="{!Contract.Purchase_Order_Number__c}"/>
How would I make this line show up only if something is typed in the purchase order field?
And then if null it would skip that line completely and go to the next part of the page.
Thanks!
- lil_ranger
- September 26, 2011
- Like
- 0
- Continue reading or reply
Outline and bookmarks not working in eclipse Force.com IDE
When working in the Force.com IDE, the contents of my Outline view keep disappearing, with nothing inside the window. It's a pretty important feature of an IDE, so it's pretty annoying.
I've been trying to use Bookmarks as a workaround, but regularly after a I save, my booksmarks all get cleared!
So there's a clearly bugs with both the Outline and Bookmarks in eclipse, at least with the Force.com IDE.
Has anyone else had this problem? Anyone know how to solve it?
It's a pain to navigate code using line numbers and 'Find' alone.
thanks
- ptepper
- August 12, 2011
- Like
- 0
- Continue reading or reply
How to create a closed task
Hi,
How do I create a Closed task using Apex?
I have the following code, but it creates an Open task.
I've also tried to replace Task with ActivityHistory, but it seems to have had the effect of making all fields read only.
Task act = new Task();
act.Subject = 'SMS: '+message;
act.Description = message+'\n'+'Sent to: '+toPhone+'\n'+'Sent From: '+FromPhone;
act.whoId = recipient_id;
act.ownerId = user_id;
act.Status = 'Closed';
act.whatId = what_id;
act.IsClosed = true; //this line doesn't compile.
Database.SaveResult sr = Database.insert (act);
Thank you.
Non essential Background:
For an SMS system I'm trying to create a "Log an SMS" button. (It actually sends the text, but that's besides the point).
I'm trying to have something along the lines of "Log a Call" button in the "Activity History" section of a contact's detail page.
- bh
- April 02, 2009
- Like
- 0
- Continue reading or reply