• Edward Gee
  • NEWBIE
  • 10 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 26
    Replies
Has anyone tried setting a lookup field by external ID in PHP using the partner API.  Here's a code snippet of what we're trying to do but when the upsert/update is called, it just hangs our app.  We tried both the field name (returns an error saying it's the wrong type) and the relationship name to no avail.  When using the relationship name, no exception is thrown, no return code is given, it just hangs.  Any ideas?
 
$messageObject = new SObject();
$messageObject->type = 'Message__c'; 
$messageObject->fields['External_ID__c'] = $data[8]; 
$sObject->fields['Original_Message__r'] = $messageObject;

 
Just curious, any ideas why the Bulk API throws an INVALID_CROSS_REFERENCE_KEY error when I pass in a #N/A as a value for the RecordTypeId field even though it's marked as nillable?  There doesn't seem to be a problem with the SOAP API when I pass in RecordTypeId to the setFieldsToNull method.

Is there a reason why the picklist values for CurrencyIsoCode only appear in the describe of an sObject via Field.getPicklistValues()?  Shouldn't they also appear in the sObject's layout via RecordTypeMapping.getPicklistsForRecordType()?  Was this an oversight?  I'm using the partner WSDL, version 13.0, but I've also tried this using version 14.0. 

We are developing/deploying solutions leveraging Visualforce pages.  Our pages contain image references to external URL sites.  When the page is rendered online, it works as expected.  However, when I apply the renderAs="pdf" attribute to our pages, the images appear as broken image links in the pdf.  I have read somewhere that we should be using static resources.  Granted that does work but it becomes a maintanence nightmare for partners when deploying solutions to many customer orgs.  Instead of maintaining the resources on our own server for many customer orgs, we would have to touch each customer org to deploy patches or upgrades.

We would like to receive some advice from Salesforce regarding this approach and discuss if this may even be a bug.

Code sample:
Code:
<!-- All of these images render fine without the renderAs="pdf" attribute -->
<apex:page renderAs="pdf">
  <h1>Congratulations</h1>
  This is your new Page: ImageTest
  <p/>
  <!-- Doesn't render in pdf -->
  <apex:image style="border:thin solid black" value="http://www.google.com/intl/en_ALL/images/logo.gif"></apex:image>
  <p/>
  <!-- Oddly enough renders in pdf -->
  <apex:image style="border:thin solid black" value="http://www.salesforce.com/common/assets/images/logo_hm_summ_nosoftware.gif"></apex:image>
  <p/>
  <!-- Renders in pdf (obviously if you have the resource "vheader" defined for your org -->
  <apex:image style="border:thin solid black" url="{!$Resource.vheader}"></apex:image>
  <p/>
</apex:page>

 

We have Translation Workbench enabled in our orgs but I cannot find a way to translate custom object labels.  Did I miss something obvious?  I can see where we translate custom field labels but nothing at the object level.  This impacts the Tab labels, the Create New... xxx label in the sidebar, the "New xxx" related list label and the label value returned from the DescribeSObject API, to name a few.

- Ed

10/22 - We figured it out.  The translations for the objects appear in a different part of the menu structure, not in the Translation Workbench, which would've been more intuitive.  For those who want to know, you have to navigate to Customize >>> Tab Names and Labels >>> Rename Tabs and Labels.  From there, you can toggle between the different languages and translate your object labels via Tab labels.  Odd but it works.


Message Edited by Edward Gee on 10-22-2008 04:31 PM
If I understand correctly, it seems you can only display result sets as one item per row on a dataTable.  What if I wanted to display the result set in a more compact way?  For example, if I had 20 items in my result set, I would like to see it in a 5x4 matrix of cells instead of 20x1 matrix of cells.  Would that be possible using Visualforce and how could that be accomplished?

- Ed
Is there a way, from an API standpoint, to determine whether a user has the ability to update/edit a particular instance of an object?  As the documentation describes, you can enable security at the object level but also at the instance level using territory management and/or sharing rules.  We tried using the MayEdit field but discovered later that this is not a standard field found on all Salesforce orgs (some of our older customers do not have this field exposed at all).  I tried reverse engineering the process by querying the respective "Share" table, if it existed, and the Group, UserTerritory tables.  Unfortunately there are some pieces of information I could not retrieve that would aid in my search.  For instance, I couldn't find a way, via API, to determine what sharing model (Private, Public Read/Write, Public Read Only) a customer applied to an object.  Is this information queryable/retrievable  somewhere?  DescribeSObject only gives object level permissions.  Anyways, if anyone has some insight on this topic, I would like to hear from you.

- Ed
Are there restrictions on what Profile properties you can view by org type via API?  We have some customer orgs who are Enterprise Edition vs Unlimited Edition.  On Enterprise Edition orgs, we noticed that System Administrators do not have access (via API) to the PermissionsEditPublicFilters property on the Profile object.  But, on Unlimited Edition orgs, they do have access to that property.  I confirmed this by logging in to their orgs via APEX Explorer and viewing what fields I can query from the Profile object.  Is there a reason why certain Profile properties are not accessible by org type via API?  Or, is it possible there is some switch they are not setting to expose this property? 

What's odd is that we can see that property (Manage Public List Views) when modifying their Profile on both org types online.  We can even set the flag and it seems the value is saved.  Any ideas?

- Ed
I'm running into the too many SOQL queries on a trigger for a given transaction and I was wondering if there's a code-wise way to solve this problem.

I'm performing a SOQL query that looks like like this:
Code:
for (....) {
TSF_vod__c tsf = [Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c Where Account_vod__c = :acct And Territory_vod__c = :terr];
}

where :acct and :terr are String type. That combination of values will return me
only one row (or none) from my TSF_vod__c object.
When "bulking" up these transactions, I would like to remove the for-loop from the SOQL and perform some post-processing of the result set:
Code:
TSF_vod__c [] tsfs = [Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where Account_vod__c In :accts And Territory_vod__c In :terrs];

where :accts and :terrs are now correlated arrays of ids.

The result set I'm expecting should contain data that the following SOQL would return:

Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where (Account_vod__c=<acctid1> And Territory_vod__c=<terrid1>) Or
(Account_vod__c=<acctid2> And Territory_vod__c=<terrid2>) Or
(Account_vod__c=<acctid3> And Territory_vod__c=<terrid3>) Or ...

In my testing, however, my attempt yielded a result set that I expect the following SOQL to return me which is not what I wanted:
Code:
Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where (Account_vod__c In (acctid1,acctid2,acctid3,...)) And
          (Territory_vod__c In (terrid1,terrid2,terrid3,...))

Is there a way to accomplish what I'm trying to do in my trigger?

- Ed
Hi all,

I'm trying to access the Profile object (e.g., to get the PermissionsEditPublicFilters value) using the currently logged in user's credentials.  It seems I can only gain access to the user's permissions for their Profile if they are a System Administrator or have the Manage Users attribute checked on.  We obviously don't want the end users to have the ability to Manage Users so is there an alternate way to retrieve the PermissionsEditPublicFilters value for a user using their credentials?

- Ed
I'm hoping I simply overlooked something but I can't seem to determine what the default value of a checkbox is on my custom object using the Partner APIs.  From a describeSObject call, I can see the default value for Text fields (and the like) via Field.getDefaultValueFormula().  For picklists, I can see the default value via Field.getPicklistValues(i).isDefaultValue().  However, for checkboxes, I can't seem to determine whether the default value is "Checked" or "Unchecked".  Am I missing something here?

- Ed
We have the Translations Workbench enabled for our org but I haven't found a way to translate our custom tab labels.  You are able to translate standard salesforce tab names (via Setup/Customize/Tab Names and Labels/Rename Tab and Labels) but not custom ones.  Why not?  Does that mean we can't provide different tab labels per language for our custom pages???  Is there any alternate way?  Am I missing something here?  Is there something else we need enabled in our org?

- Ed
Hi everyone,

The overall goal I'm trying to achieve is to retrieve language-specific data (not stored in salesforce objects) to my S-Control in an optimized manner.  One way that was devised is to include an S-Control snippet that acts as sort of a gateway to include another S-Control snippet that contains language-specific data.  For example, assume I have created the following objects:
  • Call Report - main S-Control
  • Account_Metadata - gateway snippet code that takes the language as an input parameter and returns another snippet coded for that language
  • Account_Metadata_en_US, Account_Metadata_de, Account_Metadata_es, Account_Metadata_fr, etc... - snippet code containing language-specific data
Ideally, I would like to have my Call Report S-Control contain a simple include directive as follows but unfortunately user language is not exposed as a merge field:
Code:
...
{!INCLUDE($SControl.Account_Metadata, [userLanguage="{$User.UserLanguage}"])}
...
for (var j=0; j<Account_Metadata.Salutation.length; j++) {
var label = Account_Metadata.Salutation[j].label;
var value = Account_Metadata.Salutation[j].value;
...
}
...

The Account_Metadata snippet contains the following:
Code:
{!
IF($Request.userLanguage = "en_US", INCLUDE($SControl.Account_Metadata_en_US), 
   IF($Request.userLanguage = "es", INCLUDE($SControl.Account_Metadata_es), 
      IF($Request.userLanguage = "de", INCLUDE($SControl.Account_Metadata_de), 
      ...
      ...
      }
   )
)
}
And for example, Account_Metadata_es would have the following:
Code:
<script type="text/javascript">
function Account_Metadata() {
}

Account_Metadata.Salutation = [ {label:"Sr.", value:"Sr."}, {label:"Srta.", value:"Srta."}, {label:"Sra.", value:"Sra."}, {label:"Dr.", value:"Dr."}, {label:"Prof.", value:"Prof."} ];
...
</script>

Assuming the language code snippets contained the same variable/function names, I could have referred to language-specific data in a common way from my main S-Control and swap out the data easily based on the user's language preference.  I would also save on footprint size as I wouldn't have to include every language in my S-Control.  But as mentioned above, language code is not a merge field and I don't believe the Include directive allows passing of non-constant values as parameters.

Has anyone tried solving a similar problem?  Any ideas other than requesting from salesforce to include the user language as a merge field off the User object?  Is there a way to programmatically do this by including javascript files (e.g., <script src="./es/Account_Metadata.js">?

- Ed
Originally posted in AJAX Toolkit & S-controls.

=============================================================

Does anyone know if the merge field $Profile.Name will eventually behave the same way as retrieving the Name field from the Profile object via SOQL?  Currently, the merge field value returns the "system" value (assuming it's the id linking it to the translated text of the name in another table) like PT1.  However, if I run a SOQL retrieving the Name from the Profile object, it returns the translated text in the user's language (e.g., System Administrator).

- Ed
Does anyone know if the merge field $Profile.Name will eventually behave the same way as retrieving the Name field from the Profile object via SOQL?  Currently, the merge field value returns the "system" value (assuming it's the id linking it to the translated text of the name in another table) like PT1.  However, if I run a SOQL retrieving the Name from the Profile object, it returns the translated text in the user's language (e.g., System Administrator).

- Ed
I can find examples of how to use the search() function in my S-Control but I can't find the detailed syntax of that function nor any of the other functions exposed in sforce.connection.  I've tried searching for the functions in the online help but had no luck finding the correct reference.  I've downloaded connection.js but it doesn't provide any good comments.  Does anyone have a link to some detailed documentation?

- Ed
From the Stylesheets and S-Controls Best Practice Guide, it was mentioned that we can reference an entity name to change the look and feel of our S-Control generated pages to look like that entity name.  For example:

<BODY class="account">

So what if I define my own custom object?  For example, we've created a Call object... I've tried "call", "Call", "call__c", "Call__c"... and none of them work.  Can we treat our custom objects as entities in this situation?

- Ed
Hi all,

I've built a custom HTML S-Control that is launched from a custom button with Display Type="Detail Page Button" and Behavior="Display in existing window with sidebar".  What is the recommended way to return the user back to the calling page that launched my HTML S-Control?  Should I be grabbing the query parm "eid"  from the URL and construct a relative URL with that object id or is there a better way of doing this?

- Ed
We have Translation Workbench enabled in our orgs but I cannot find a way to translate custom object labels.  Did I miss something obvious?  I can see where we translate custom field labels but nothing at the object level.  This impacts the Tab labels, the Create New... xxx label in the sidebar, the "New xxx" related list label and the label value returned from the DescribeSObject API, to name a few.

- Ed

10/22 - We figured it out.  The translations for the objects appear in a different part of the menu structure, not in the Translation Workbench, which would've been more intuitive.  For those who want to know, you have to navigate to Customize >>> Tab Names and Labels >>> Rename Tabs and Labels.  From there, you can toggle between the different languages and translate your object labels via Tab labels.  Odd but it works.


Message Edited by Edward Gee on 10-22-2008 04:31 PM
Has anyone tried setting a lookup field by external ID in PHP using the partner API.  Here's a code snippet of what we're trying to do but when the upsert/update is called, it just hangs our app.  We tried both the field name (returns an error saying it's the wrong type) and the relationship name to no avail.  When using the relationship name, no exception is thrown, no return code is given, it just hangs.  Any ideas?
 
$messageObject = new SObject();
$messageObject->type = 'Message__c'; 
$messageObject->fields['External_ID__c'] = $data[8]; 
$sObject->fields['Original_Message__r'] = $messageObject;

 

The main visualforce page looks something like:

 

<apex:page id="mainPage" tabStyle="Custom_Visualforce__tab" controller="SomeCustomController">

-- some content --

<apex:outputPanel layout="block" id="detail">
<apex:iframe src="{!someUrl}" scrolling="false" height="500px" width="100%" />
</apex:outputPanel>

</apex:page>

 

 

 

"someUrl" points to the following visualforce page:

<apex:page standardController="Document" standardStylesheets="true" tabStyle="Custom_Visualforce__tab" extensions="SomeDifferentCustomController" showHeader="false" sidebar="false" >

-- some content --

</apex:page>

 

 

The main visualforce page appears styled according to the Custom_Visualforce__tab style.  However, the visualforce page style in the iFrame appears all black.

 

 

Is it possible to style a VF page in an iframe so that it follows a custom tab style?

We are developing/deploying solutions leveraging Visualforce pages.  Our pages contain image references to external URL sites.  When the page is rendered online, it works as expected.  However, when I apply the renderAs="pdf" attribute to our pages, the images appear as broken image links in the pdf.  I have read somewhere that we should be using static resources.  Granted that does work but it becomes a maintanence nightmare for partners when deploying solutions to many customer orgs.  Instead of maintaining the resources on our own server for many customer orgs, we would have to touch each customer org to deploy patches or upgrades.

We would like to receive some advice from Salesforce regarding this approach and discuss if this may even be a bug.

Code sample:
Code:
<!-- All of these images render fine without the renderAs="pdf" attribute -->
<apex:page renderAs="pdf">
  <h1>Congratulations</h1>
  This is your new Page: ImageTest
  <p/>
  <!-- Doesn't render in pdf -->
  <apex:image style="border:thin solid black" value="http://www.google.com/intl/en_ALL/images/logo.gif"></apex:image>
  <p/>
  <!-- Oddly enough renders in pdf -->
  <apex:image style="border:thin solid black" value="http://www.salesforce.com/common/assets/images/logo_hm_summ_nosoftware.gif"></apex:image>
  <p/>
  <!-- Renders in pdf (obviously if you have the resource "vheader" defined for your org -->
  <apex:image style="border:thin solid black" url="{!$Resource.vheader}"></apex:image>
  <p/>
</apex:page>

 

Hi ,
         I am facing some issues on apex governor  limits. can anyone please tel me how to use getQueries() and getLimitQueries() in an simple Apex class..
Is there a way, from an API standpoint, to determine whether a user has the ability to update/edit a particular instance of an object?  As the documentation describes, you can enable security at the object level but also at the instance level using territory management and/or sharing rules.  We tried using the MayEdit field but discovered later that this is not a standard field found on all Salesforce orgs (some of our older customers do not have this field exposed at all).  I tried reverse engineering the process by querying the respective "Share" table, if it existed, and the Group, UserTerritory tables.  Unfortunately there are some pieces of information I could not retrieve that would aid in my search.  For instance, I couldn't find a way, via API, to determine what sharing model (Private, Public Read/Write, Public Read Only) a customer applied to an object.  Is this information queryable/retrievable  somewhere?  DescribeSObject only gives object level permissions.  Anyways, if anyone has some insight on this topic, I would like to hear from you.

- Ed
I'm running into the too many SOQL queries on a trigger for a given transaction and I was wondering if there's a code-wise way to solve this problem.

I'm performing a SOQL query that looks like like this:
Code:
for (....) {
TSF_vod__c tsf = [Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c Where Account_vod__c = :acct And Territory_vod__c = :terr];
}

where :acct and :terr are String type. That combination of values will return me
only one row (or none) from my TSF_vod__c object.
When "bulking" up these transactions, I would like to remove the for-loop from the SOQL and perform some post-processing of the result set:
Code:
TSF_vod__c [] tsfs = [Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where Account_vod__c In :accts And Territory_vod__c In :terrs];

where :accts and :terrs are now correlated arrays of ids.

The result set I'm expecting should contain data that the following SOQL would return:

Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where (Account_vod__c=<acctid1> And Territory_vod__c=<terrid1>) Or
(Account_vod__c=<acctid2> And Territory_vod__c=<terrid2>) Or
(Account_vod__c=<acctid3> And Territory_vod__c=<terrid3>) Or ...

In my testing, however, my attempt yielded a result set that I expect the following SOQL to return me which is not what I wanted:
Code:
Select Id,Account_vod__c,Territory_vod__c From TSF_vod__c
Where (Account_vod__c In (acctid1,acctid2,acctid3,...)) And
          (Territory_vod__c In (terrid1,terrid2,terrid3,...))

Is there a way to accomplish what I'm trying to do in my trigger?

- Ed
Hi all,

I'm trying to access the Profile object (e.g., to get the PermissionsEditPublicFilters value) using the currently logged in user's credentials.  It seems I can only gain access to the user's permissions for their Profile if they are a System Administrator or have the Manage Users attribute checked on.  We obviously don't want the end users to have the ability to Manage Users so is there an alternate way to retrieve the PermissionsEditPublicFilters value for a user using their credentials?

- Ed
I've been working with the Describe Layout utility but am not getting where I would capture a field's read-only property.  My first thought was that "editable" on DescribeLayoutItem would simply be set to false.  No dice. Any advice? 

Thanks!
I'm hoping I simply overlooked something but I can't seem to determine what the default value of a checkbox is on my custom object using the Partner APIs.  From a describeSObject call, I can see the default value for Text fields (and the like) via Field.getDefaultValueFormula().  For picklists, I can see the default value via Field.getPicklistValues(i).isDefaultValue().  However, for checkboxes, I can't seem to determine whether the default value is "Checked" or "Unchecked".  Am I missing something here?

- Ed
Hi,

I've this issue where my custom s-control when dropped on a page layout needs to find the type of object it is on.

Such as if the control is on Case page layout, it should be able to get the {Case.Id} and if on the Account page should be able to access {Account.Id}. I can put if else statements as long as i can find out the type of Object the control is called from.

I have an alternative solution, i.e. to create several controls, specific to an object type, but i would like to re-use code as much as possible and have one solution.

Regards

I can find examples of how to use the search() function in my S-Control but I can't find the detailed syntax of that function nor any of the other functions exposed in sforce.connection.  I've tried searching for the functions in the online help but had no luck finding the correct reference.  I've downloaded connection.js but it doesn't provide any good comments.  Does anyone have a link to some detailed documentation?

- Ed
From the Stylesheets and S-Controls Best Practice Guide, it was mentioned that we can reference an entity name to change the look and feel of our S-Control generated pages to look like that entity name.  For example:

<BODY class="account">

So what if I define my own custom object?  For example, we've created a Call object... I've tried "call", "Call", "call__c", "Call__c"... and none of them work.  Can we treat our custom objects as entities in this situation?

- Ed
Hi all,

I've built a custom HTML S-Control that is launched from a custom button with Display Type="Detail Page Button" and Behavior="Display in existing window with sidebar".  What is the recommended way to return the user back to the calling page that launched my HTML S-Control?  Should I be grabbing the query parm "eid"  from the URL and construct a relative URL with that object id or is there a better way of doing this?

- Ed