• kevohara
  • NEWBIE
  • 50 Points
  • Member since 2011
  • CTO
  • LevelEleven


Badges

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 51
    Replies

It seems that the new Summer'13 update enforces you to work with 18 character ID's always. For example, this happens in apex:

 

Id Id15 = string.valueOf(Id18).substring(0,15);
System.AssertEquals (Id15,Id18);

 

Pre-Summer that assertion fails, as Id15 is the 15 character Id and Id18 is the 18 character Id.
In our custom code many times we use Custom Setting and Custom Labels to avoid hardcoding recordtypes, profiles and other "constant" values. We usually worked with 15 character Ids as Salesforce (SOQL) sometimes returns 15 and other times returns 18 character Ids.

 

Now it seems the ID type always returns 18 character, if you do something like this the assertion is true:

 

Id Id15 = '012200000005byN';
System.AssertEquals (Id15,'012200000005byNAAQ');

 

As this is happening now with the Summer'13 but not happening before with Spring'13, this invalidates many coding.

We found this problem as Salesforce triggered a deep system error like this Salesforce System Error: 1619326252-34083 (1564369920) (1564369920) trying to compare a SelectOption loaded with record types with a Custom Settings String Id Stored.

 

This is a really weird annoyance. You can take a workaround working always with ID type instead of storing Ids into Strings, and always working with 18 character Ids, wether you hardcode Ids into apex and formulas (not a good approach) or you use custom setting and labels to store the ids.

 

Hope this helps... I lost all morning trying to figure out this.

I'm looking into the option of building a public facing REST based API on force.com but there is one issue about this that sticks out. Unlike public Visualforce pages, in which you can provide a custom URL (sort of, SSL is still not fully branded) there is no way to setup custom URLs for Apex REST or SOAP services. This includes logging in and invoking actions.

 

Even if we could brand these Apex Web Services we would still have the SSL issue. If salesforce.com wants force.com to become a real option for buidling services on it this issue needs to be addressed.

 

In the mean time is anyone familiar with work arounds? A proxy server perhaps that simply redirects requests to salesforce.com? I have no idea if this would work, just throwing out ideas.

 

Thanks,

Jason

I feel like I periodically run into this issue and feel quite certain that this is a bug. Maybe someone can help.

 

In my controller, I have a Map that looks like this...

 

Map<String, List<CustomObjectWrapper>> objMap;

 My key is a category field for my Custom Object wrapper which looks like this...

 

public class CustomObjectWrapper {
  public boolean selected {get; set;}
  public Custom_Object__c customObject {get; set;}
}

 

 What I am doing in my Visualforce page is create a pageBlockTable for each of the keys (my category) in the map. The values are put into a table and the Description__c field is available for editing. Here is an example.

 

<apex:repeat value="{!objMap}" var="category" >
  <apex:pageBlock title="Category: {!category}">
    <apex:pageBlockTable value="{!objMap[category]}" var="obj">
      <apex:column value="{!obj.customObject.Name}" />
      <apex:column value="{!obj.customObject.Category__c}" />
      <apex:column headerValue="Description">
        <apex:inputField value="{!obj.Description__c}"/>
      </apex:column>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:repeat>

 

Now here is the weird part...

 

I have save button on the page that simply updates the records. 99% of the time the records update with no problem. However, when there are two keys in the map of category "VOE" and "Reference", the controller misplaces the values for the Description__c field. The descriptions get saved on the incorrect records. Anything other than the combination of those two keys works fine! Completely bizarre.

 

I've read a bit about some dynamic VF issues with Maps but I don't see anythin definitive in the "Known Issues" list on the community site. Does anyone know if this is indeed a bug? And if so, are there any workarounds?

I am using v24.0 of the IDE. I have some test classes that have some initilization code in a static block. In this block I am inserting a record. I realized after the fact that I was not setting a required field on the record I was inserting. The odd thing is that this insert is failing silently and not showing an error. This behavior started after I updated the IDE to v24. v23 shows the uncaught exception as it should.

 

Has anyone else experienced this issue? When I open up the Test Runner Debug Log I can see the exception but I am not being prompted like in the past. This is making debugging really hard.

 

P.S. Before someone asks, I am not wrapping this in a try/catch block. :)

Is there a one-step way to wipe-out an org?

I was able to do a one-step deploy by using the migration tool. Now, I want to do a one-step undeploy.

I tried renaming the package.xml to destructiveChanges.xml as I read over there, but it doesn't work. I got errors like these:

Error: workflows/Domain__c.workflow(Domain__c):Cannot delete a workflow object;

Workflow Rules and Actions must be deleted individually

Warning: destructiveChanges.xml:No CustomObject named: * found
Warning: destructiveChanges.xml:No ApexPage named: * found
Warning: destructiveChanges.xml:No ApexComponent named: * found
Warning: destructiveChanges.xml:No StaticResource named: * found

What I'm doing right now is to create a new org each time a new to do a fresh deploy.

I really hope this is already implemented, if not please advise me in where to ask this to salesforce technical support.

Thanks!

ı have more than 1 before trigger for the same object. Can anyone knows a good template for that? Both of them works great in Sandbox but I receive null pointer error from the test code.

I have a client who wants to use Salesforce for two completely different things - one group will use one set of tables (objects), and the other group will use another set of tables. There is no interaction between to two sets of functionality.

 

One set of functionality is already developed and working. The other is my job.

 

Should I just create new objects and pages inthe existing application, and then set up profiles so that one group sees their stuff, and the other group sees their stuff? Or should I create two completely different applications?

 

If the latter, how do I get to a screen with an essentially blank application. When I click on the link to create a new applicatication, I just get sent to developer.force page.

 

Thanks in advance for any help.

I am creating a validation "before" trigger that I am using to validate fields before inserting a record.  What I want to do is to create a log record every time a validation fails.  Ideally, I would want to:

 

1) Display the validation error to the user in typical fashion using the addError() method.

 

2) Insert a Log record into my custom object called "Log__c" to record the incident.

 

I can't find it in the docs, but the usage of the addError() method seems to disallow any DML...even to my custom object.  Whats weird is that I am not getting an exception on my insert statement.  In fact, the debug logs show that the insert was executed successfully, however, no record is actually created in my Log object.  My guess is that there is a rollback occurring when addError() is used.

 

I thought that executing my DML in a asynchronous method would circumvent this so I moved the log insertion into an @future method.  This didn't help either.

 

Is there a way I can perform this insert when my before trigger calls an addError() method on a field?

Hi All,

 

I'm very (very) new to Apex code development but am trying to accomplish a simple task. I have a custom button that points to a VisualForce where I intend to call a short code through a controller. I need the block of code to take a simple action: update the record owner Id (on the Account object) to the current user's ID who has just clicked the button. Simply, this button allows someone to 'claim' an Account. 

 

Any help at all would be greatly appreciated - I'm failing miserably at writing the code!

 

Thx.

Hi all,

 

This may end up being a dumb question, but I'm very grateful for any help! I have a trigger that I'm trying to test, and though it works when I test it manually via a UI case update, I can't get the test to work at all.

 

The trigger is designed to catch cases before update and, if the associated asset has changed, update a field on the case to match a corresponding field on its asset. Here's a snippet of the test:

 

[test cases and assets created and inserted above, including optedInAsset and caseForOptedOutAsset ...]

Case updatedVersion1 = [Select Id, Opt_In__c, AssetId from Case where Id=:caseForOptedOutAsset.Id limit 1];

updatedVersion1.AssetId = ID.valueOf(optedInAsset.Id);

update updatedVersion1;

updatedVersion1 = [Select Id, Opt_In__c, AssetId from Case where Id=:updatedVersion1.Id limit 1];

System.assertEquals(true, updatedVersion1.Opt_In__c);

[...]

 

For some reason, this assert always fails, though, again, it works smoothly in the UI. I don't seem to even be able to force it--it's like the "before update" trigger is being ignored, and the AssetId field is just being updated without firing any trigger.

 

Is there anything that could cause a trigger to not fire or be somehow truncated in the context of an Apex test?

 

Thanks again!

 

I wanted to know if there's a traditional way of using ajax within VF. I get the ease of using VF functions but it will be a nightmare to separate out the code if you decide to move to another platform and reuse the same front end code. For instance, we have an app that temporarily use Salesforce but eventually will move to its own portal because SF cannot meet all of our needs. I want my javascript/css to be completely separated from VF so when it's time to move, it will be a simple as swapping our URL's inside the javascript files for the Ajax requests.

 

Thai

I am trying to import google analytics data (date, page views, visitors) on a daily basis, and want past data available for reporting / dashboards (kind of like historical invoices).

 

What are the best practices around doing this?

 

I created a custom object and custom fields, but it seems like that will be overwritten daily, and won't give me a nicely formatted excel-style list with columns.

 

Is there a way to create a custom related list, or should I create custom fields within the activity lists and use those?

 

My longer term plan is to have a number of different custom metrics, imported daily, so I want to start off correctly.

 

thanks in advance.

1.       What are the Cloud Srevices available in salesforce?

Hi,

I am trying to migrate profiles from one salesforce org to the other through eclipse. I have included all possible components in the project from the source org and when I deploy the profile to the target development org using the 'deploy to server wizard' of eclipse. It deploys on the profile on the target org but there are certain mismatches in the deployed profile. These mismatches are related to tabviibilities, standard object permissions and general user permissions. 

Is there a bug here in the metadata deployment of profiles or am I missing something here ?

Thanks in advance.