• Ankush Somani
  • NEWBIE
  • -1 Points
  • Member since 2014

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

I am connecting one org to another org using REST API
I have already set remote site access setting is as follow:
https://login.salesforce.com, and https://ap1.salesforce.com as a instance url.
i am geting authorozie code as a 1st step, but when i am trying to get access_token as a 2nd step of web-server authorization flow, getting this error.
i am setting endpoint in request "https://login.salesforce.com/services/oauth2/token"
please help me.

i am setting my request body:
requestbody ='grant_type='+GRANT_TYPE+'&code='+codeparam+'&client_id='+CLIENT_ID+'&client_secret='+CLIENT_SECRET+'&redirect_uri='+REDIRECT_URL;

using POST method

I have a batch class that updated a custom object when a trigger runs. 

Sceniro: Someone adds a state to a multi select picklist. The trigger will grab all states, and throw the last state in the variable. I then grab the id of the record in another variable. I pass both of those variables over to a batch class and run a query on another custome object, and update the fields. 

Problem is, when I get to the update part, the first field (Flow_Kick_Off__c) gets the value of the variable, but the other field (Territory__c) does not..... I don't understand why one field is getting updated, but not the other. 

Here is the trigger:
trigger updateFacility on Territory__c (before insert, before update) {
    
    //Adding a state index is -1. Removing a state index is normal.
    
    String[] oldStates;
    String[] newStates;
    Integer countStates;
    Integer countOldStates;
    Integer countNewStates;
    String terrID;
    String terrState;
    
    if(Trigger.isUpdate) {
        for(Territory__c oldTerr : Trigger.old) {
            oldStates = oldTerr.states__c.split(';');
            countOldStates = oldStates.size();
            terrID = oldTerr.Id;
        }
        
    }
    
    else if(Trigger.isInsert) {
        
    }
    
    for(Territory__c newTerr : Trigger.new) {
        newStates = newTerr.states__c.split(';');
        countNewStates = newStates.size();
        
        if(countNewStates > countOldStates) {
            terrState = newStates[countNewStates-1];
            System.debug('TRIGGER ID = ' + terrID);
            System.debug('TRIGGER STATE = ' + terrState);
            FacilityUpdates db = new FacilityUpdates(terrState, terrID);
            database.executeBatch(db, 75);
        }
        
        else {
            
        }
        
    }
    
    
}

Here is the class: The only field that is not updating is (Territory__c)
global class FacilityUpdates implements Database.Batchable<sObject> {
    
    global String terrState;
    global String terrID;
    
    
    global FacilityUpdates(String myStates, String terID){
        terrState = myStates;
        terrID = terID;
        system.debug('STATE = ' + myStates);
        system.debug('ID = ' + terID);
    }
    
    public String query;
    
    global Database.querylocator start(Database.BatchableContext BC){
        
        //String newString = '\'';
        system.debug('INSIDE EXECUTE STATE = ' + terrState);
        
        query = 'Select id, Name, physical_State__c, Territory__c FROM Facility__c WHERE physical_State__c = :terrState';
        //query = 'Select id, Name, physical_State__c, Territory__c FROM Facility__c WHERE Territory__c = :terrId AND physical_State__c includes ' + states;
        
        
        system.debug(query);
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<sObject> scope){
        List<Facility__c> accns = new List<Facility__c>();
        for(sObject s : scope)
        {
            Facility__c a = (Facility__c)s;
            a.Flow_Kickoff__c = terrID;
            a.Territory__c = terrID;
            accns.add(a);
        }
        update accns;
        
    }
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}

 
Hi all,

For authorization to an endpoint I need a signature based on the HMAC SHA256 encryption. This signature should be created from a query string and a secret key.

I use the following code in apex to create the signature. The problem is that it returns a signature with 44 characters including non alphanumeric characters where I would expect a signature with 64 alphanumeric characters. If I use any of the online HMAC SHA256 converters I get a valid signature with 64 alphanumeric characters.

How can I modify the apex code so I will receive a signature with 64 alphanumeric characters that is complient to '^[A-Fa-f0-9]{64}$'
 
public class generateHmac {

        public static void generateSignature() {
                    DateTime dateTimeNow = dateTime.now();
        String unixTime = ''+dateTimeNow.getTime()/1000;
    string url = 'timestamp=' + unixTime;

string privateKey = 'PRIVATEKEY';


Blob privateKeyBlob = EncodingUtil.base64Decode(privateKey);
//Blob privateKeyBlob = Blob.valueOf(privateKey);
Blob urlBlob = Blob.valueOf(url);
Blob signatureBlob = Crypto.generateMac('HmacSHA256', urlBlob, privateKeyBlob);

String signature =EncodingUtil.base64Encode(signatureBlob);
            
system.debug('signature is ' +signature);

        } 
}

 

I am connecting one org to another org using REST API
I have already set remote site access setting is as follow:
https://login.salesforce.com, and https://ap1.salesforce.com as a instance url.
i am geting authorozie code as a 1st step, but when i am trying to get access_token as a 2nd step of web-server authorization flow, getting this error.
i am setting endpoint in request "https://login.salesforce.com/services/oauth2/token"
please help me.

i am setting my request body:
requestbody ='grant_type='+GRANT_TYPE+'&code='+codeparam+'&client_id='+CLIENT_ID+'&client_secret='+CLIENT_SECRET+'&redirect_uri='+REDIRECT_URL;

using POST method

Hi All,

 

I did start with this thread: http://boards.developerforce.com/t5/General-Development/Install-Eclipse-Juno-4-2-with-Force-com-IDE/m-p/462323/highlight/true#M72103

 

But I am still running into the same problem. Here's my setup: 

 

Here's my setup

- Running Eclipse 4.2 as Admin (downloaded from here: http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junor) and installed to desktop.

- JAVA_HOME set to C:\Program Files\Java\jdk1.7.0_05 (upgraded from jdk1.6.0_23) downloaded from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html

- Tried installing the Force.com IDE from the Eclipse Marketplace and got this error:

 

Cannot complete the install because one or more required items could not be found.
  Software being installed: Force.com IDE 25.0.0.201206181021 (com.salesforce.ide.feature.feature.group 25.0.0.201206181021)
  Missing requirement: Force.com IDE 25.0.0.201206181021 (com.salesforce.ide.feature.feature.group 25.0.0.201206181021) requires 'org.eclipse.update.ui 0.0.0' but it could not be found

 

Have I installed something incorrectly or overlooked something?

I am looking for a way to let a customer portal user  trigger a action which assign him to a different profile.

I have tried with, triggers, @future method, time based workflow but these approaches all leads to the

FIELD_INTEGRITY_EXCEPTION, Cannot change profile for current user.

 

Is it at all possible that a customer portal user activate a profile change for himself? 

  • March 26, 2012
  • Like
  • 0

Hi All,

 

I would like to add more values to a formula that uses "contains()" a few times but I receive an error message because it exceeds the character limitation.

 

Is there any way to make the formula more efficient when you compare a field to different values?

 

I.e 

 

IF (

OR (prob=1, prob=2,

CONTAINS(Part_Pumber__c , "SETUP"),

CONTAINS (Part_Number__c , "UNKNOWN"),
CONTAINS (Part_Number__c , "MCC"),
CONTAINS(Part_N__c , "RETAINER"),
CONTAINS( Part_N__c , "REFINEMENT"),
CONTAINS( Part_Number__c , "SCAN"),
CONTAINS( Part_Number__c , "REFINEMENT"),
CONTAINS( Part_N__c , "WARR"),
CONTAINS( Part_Number__c , "WARR"),
CONTAINS( Part_Number__c , "ALIGNER"),
CONTAINS( Part_N__c , "REPLACEMENT"),
CONTAINS( Part_N__c , "TEMPLATE"),
CONTAINS( Part_N__c , "REPL."),
CONTAINS( Part_Number__c , "4645"),
CONTAINS( Part_Number__c , "7876"),
CONTAINS( Part_Number__c , "7877"),
CONTAINS( Part_Number__c , "7878"),
CONTAINS( Part_Number__c , "5369"),
CONTAINS( Order_Type__c , "SR"),
Part_Number__c ="",
CONTAINS( Part_Number__c, "5006" )), 0,1)

 

I have tried the following but it doesn't work:

 

IF(OR ( prob =1, prob =2,
CONTAINS ("SETUP:UNKNOWN:MCC:SCAN:REFINEMENT:WARR:ALIGNER:4645:7876:7877:7878:5369:", Part_Number__c ),
CONTAINS ("RETAINER:REFINEMENT: WARR: REPLACEMENT:TEMPLATE:REPL.:",Part_N__c),
CONTAINS( Order_Type__c , "SR"),
Part_Number__c =""),
0,
1)

 

 

Any advise would be highly appreciated.

 

Thank you!

Judith