• jlcoverity
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 12
    Replies

Hello all, Would someone please explain to me why this:

 

Pattern p = Pattern.compile('^AMAZON(\\.COM)?($|[,-\\s]+');

 

Would produce this error:

 

08:18:26.042 (42021000)|EXECUTION_STARTED 08:18:26.042 (42032000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 08:18:26.043 (43805000)|FATAL_ERROR|System.StringException: Invalid regex: Illegal character range near index 22 ^AMAZON(\.COM)?($|[,-\s]+

 

What's up with the substitution of the pipe character???

 

This regex works perfectly fine in Javascript.

 

Thanks, -jl

Hi everyone,

 

I'm developing a web app (using node.js/express and angular.js) that integrates with SFDC. I'm using oauth2 and the login dance is working fine. However, I want to include a logout mechanism as well. Here's my logout code: 

 

app.get('/logout', function(req,res) {
   var callback = function() {
       res.redirect('/');
   };

   if(req.session.oauth) {

       var uri = req.session.oauth.instance_url + '/services/oauth2/revoke?token='+req.session.oauth.access_token;
       var reqOpts = {
           uri : uri,
           method: 'GET'
       };
       request(reqOpts,function(err,res) {
          if(err)
           console.log('ERROR' + err.message);
          else {
            console.log('Returned from oauth2 revoke with code ' + res.statusCode);
            callback();
          }
       });
   }
});

When it returns, the callback redirects to "/" which basically checks to see if req.session.oauth is null. If it is null, then it renders my login.ejs page (a login page w/a button to "Login with Salesforce" to initiate the oauth dance), otherwise it renders my index.ejs page.  

 

app.get('/', function(req,res) {
    console.log(req.session.oauth);
    if(!req.session.oauth)
        res.render("login");
    else
        res.render("index");
});

 

I'm getting a status code of 200 back from the call to /services/oauth2/revoke, but it always renders the index page and not the login page. The output from the console.log shows that the oauth session definitely not null and the access token is still present. I am clearly missing something pretty basic here, but can't quite put my finger on it. 

At Coverity, we're looking for a talented, highly motivated individual to manage our Salesforce.com implementation and to drive innovation and best practices to ensure the platform continues to meet the needs of our users and scales with our company's growth.

 

Here's the link to the job description: http://hire.jobvite.com/Jobvite/Job.aspx?m=nlGZVgwG&j=occkVfwn

 

 

Hello all, Would someone please explain to me why this:

 

Pattern p = Pattern.compile('^AMAZON(\\.COM)?($|[,-\\s]+');

 

Would produce this error:

 

08:18:26.042 (42021000)|EXECUTION_STARTED 08:18:26.042 (42032000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 08:18:26.043 (43805000)|FATAL_ERROR|System.StringException: Invalid regex: Illegal character range near index 22 ^AMAZON(\.COM)?($|[,-\s]+

 

What's up with the substitution of the pipe character???

 

This regex works perfectly fine in Javascript.

 

Thanks, -jl

Hi everyone,

 

I'm developing a web app (using node.js/express and angular.js) that integrates with SFDC. I'm using oauth2 and the login dance is working fine. However, I want to include a logout mechanism as well. Here's my logout code: 

 

app.get('/logout', function(req,res) {
   var callback = function() {
       res.redirect('/');
   };

   if(req.session.oauth) {

       var uri = req.session.oauth.instance_url + '/services/oauth2/revoke?token='+req.session.oauth.access_token;
       var reqOpts = {
           uri : uri,
           method: 'GET'
       };
       request(reqOpts,function(err,res) {
          if(err)
           console.log('ERROR' + err.message);
          else {
            console.log('Returned from oauth2 revoke with code ' + res.statusCode);
            callback();
          }
       });
   }
});

When it returns, the callback redirects to "/" which basically checks to see if req.session.oauth is null. If it is null, then it renders my login.ejs page (a login page w/a button to "Login with Salesforce" to initiate the oauth dance), otherwise it renders my index.ejs page.  

 

app.get('/', function(req,res) {
    console.log(req.session.oauth);
    if(!req.session.oauth)
        res.render("login");
    else
        res.render("index");
});

 

I'm getting a status code of 200 back from the call to /services/oauth2/revoke, but it always renders the index page and not the login page. The output from the console.log shows that the oauth session definitely not null and the access token is still present. I am clearly missing something pretty basic here, but can't quite put my finger on it. 

Hi,

According to this: http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com , once I get the 401 error ('Session expired or invalid'), I should be able to use the refresh token to obtain a new access token.

 

However, anytime I attempt to refresh the token, the response comes without error messages, but with the same old access token that is expired or invalid.

 

 

How can that be possible ? Isn't it supposed to return a new access token ?

 

Thanks!

Hi,

 

I'm trying to create a couple share records for a custom object we have. To be more especific, I'm using a trigger (after insert) to take CustomObject being created, execute some logic to get a list of User objects and give access to those users using CustomObject__Share.

 

For instance:

 

User[] users /* = Execute logic to get a list of users. */

 

for(User user : users) {
                System.debug(request.Id);
                System.debug(user.Id);
                insert new CustomObject__Share(ParentId = Trigger.new[0].Id,
                                                    UserOrGroupId = user.Id,
                                                    AccessLevel = 'Read'
                                                    );
            }

 

But everything runs smoothly until it yeilds "insufficient access rights on cross-reference id" when I'm about to insert my new CustomObject__Share instance. I've been searching for information regarding this exception, but every effor until now has been fruitless, this error is not very much self-describing.

 

Could somebody help me by explaining the meaning of this exception in this context?

Where should I looks about where to solve this issue?

I am running into a very serious error with deploys, and before I log a case, was wondering if anyone else has seen this.

 

I have two sandboxes, A and B.  A is in Spring 11 and B is in Summer 11.

 

In my org, I have a VF Page and its controller which utilizes javascript remoting.  It works fine in both Sandbox A and B.

 

Now lets say I make a change to an sobject, such as adding a field that is not referenced anywhere, then deploy just this changed sobject to sandbox B.

 

After the deploy, the VF Page and its controller break in Sandbox B, but continue to work in Sandbox A.  The error given is a strange one:

 

Visualforce Remoting Exception: Cannot call test methods in non-test context

 

I am definitely not calling test methods from my remote apex.  If I drill into the error with Firebug, I can see it gets thrown in the following code (which is salesforces):

 

 

Visualforce.remoting.Util = {
log: function(msg, obj) {
if (typeof console === 'undefined' || !console.groupCollapsed || !console.log || !console.groupEnd) return;
if (typeof obj !== 'undefined' && obj !== null) {
try {
console.groupCollapsed(msg);
console.log(obj);
console.groupEnd();
} catch(e) {}
} else {
try { console.log(msg); } catch(e) {}
}
}, 

 

 

I can then add one dummy line (it literally does not matter what I add) of code to the problematic VF page and its controller, then I can redeploy the page and its controller, and things work again in Sandbox B.

 

This is quite strange, but I can consistently reproduce it with these steps.

 

Any ideas?

At Coverity, we're looking for a talented, highly motivated individual to manage our Salesforce.com implementation and to drive innovation and best practices to ensure the platform continues to meet the needs of our users and scales with our company's growth.

 

Here's the link to the job description: http://hire.jobvite.com/Jobvite/Job.aspx?m=nlGZVgwG&j=occkVfwn

 

 

I need a way to apply lead assignment rules whenever the lead score goes above 99 and the lead review status is complete.

 

Here is my trigger code:

 

 

trigger ApplyLeadAssignmentRules on Lead (before update, before insert) {


    for (Lead l:trigger.new) {


        Decimal score =   l.Score__c;
        String review_status =  l.Review_Status__c;

        if(score == null) score = 0.0;
        if(review_status == null) review_status = '';
            
        if( (score >= 100) && (review_status.equalsIgnoreCase('Complete'))  ){
            Database.DMLOptions dmo = new Database.DMLOptions();
            dmo.assignmentRuleHeader.useDefaultRule = true;
            l.setOptions(dmo);
            Database.update(l);   
        }     

    }


}

 

 

This throws the following exception:

 

Apex script unhandled trigger exception by user/organization:

Source organization:

ApplyLeadAssignmentRules: execution of BeforeUpdate

caused by: System.DmlException: Update failed. First exception on row 0 with id ; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 00QQ0000001Q2av) is currently in trigger ApplyLeadAssignmentRules, therefore it cannot recursively update itself: []

 

 

How do I fix this? Any solution?

Originally it was supposed to be Feb 15th --> http://developer.force.com/releases/release/Spring10/IDE

 

Then Tech Support told me it would be March 5th.

 

Today is March 7th and I still don't see it.

 

Does any know what is going on with the plugin? (or does SFDC just want to keep the developers in the dark)