• Praveen Kumar Bonalu
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
I am facing an error while trying to establish the Oauth connection (JWT) between talend ETL tool and salesforce :
runtime exception https status 400-bad request message {"error":"invalid_grant","error_description":"audience is invalid"}
Here are the steps I have performed :
  • Downloaded the self signed certificate from salesforce.
  • Created the connected app
  • Used following url to authenticate the user
         https://test.salesforce.com/services/oauth2/authorize? client_id=&     redirect_uri=https://test.salesforce.com/services/oauth2/success& response_type=code
Settings on talend connection:
  • Name : Name of the Connection
  • Connection Type : oAuth
  • Oauth2 flow type : Json web token Flow
  • Issuer : client_Id from connected app
  • Subject : Salesforce userName
  • Expiration in time : 600
  • Keystore : Certificate from salesforce
  • Keystore Password : password for certificate
  • Certificate alias : Name of the certificate.
  • Advanced setting : Salesforce Url :https://test.salesforce.com/services/oauth2
Talend Configuration
Hi SalesforceDev,

I am trying to Implement the  Generic SOAP Callout Framework Class in salesforce. Did anyone tried to implement the Generic class to call out a stub class(methods) 

Example:
Global class generic_Soap_Callout()
{

 global void RetriveCallout(Stub class ,Method,input parameter's);
{
    
}
return response;
}

Apex Class: (needs to use the generic class and do a callout)


@remote
public void generateinvoice()
{
 generic_Soap_Callout.RetriveCallout(Billingservice,upsertbill,billnumber);
}

I really Appreciate your help.

Thanks






 
Hi,

I would like to know how to write a test class for the custom Jit controller.

Controller:
global class StandardUserHandler implements Auth.SamlJitHandler {
    private class JitException extends Exception{}
    private void handleUser(boolean create, User u, Map<String, String> attributes,
        String federationIdentifier, boolean isStandard) {
        if(create && attributes.containsKey('User.Username')) {
            u.Username = attributes.get('User.Username');
        }
        if(create) {
            if(attributes.containsKey('User.FederationIdentifier')) {
                u.FederationIdentifier = attributes.get('User.FederationIdentifier');
            } else {
                u.FederationIdentifier = federationIdentifier;
            }
        }
        if(attributes.containsKey('User.ProfileId')) {
            String profileId = attributes.get('User.ProfileId');
            Profile p = [SELECT Id FROM Profile WHERE Id=:profileId];
            u.ProfileId = p.Id;
        }
        if(attributes.containsKey('User.UserRoleId')) {
            String userRole = attributes.get('User.UserRoleId');
            UserRole r = [SELECT Id FROM UserRole WHERE Id=:userRole];
            u.UserRoleId = r.Id;
        }
        if(attributes.containsKey('User.Phone')) {
            u.Phone = attributes.get('User.Phone');
        }
        if(attributes.containsKey('User.Email')) {
            u.Email = attributes.get('User.Email');
        }


        if(!create) {
            update(u);
        }
    }

    private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        if(communityId != null || portalId != null) {
            String account = handleAccount(create, u, attributes);
            handleContact(create, account, u, attributes);
            handleUser(create, u, attributes, federationIdentifier, false);
        } else {
            handleUser(create, u, attributes, federationIdentifier, true);
        }
    }

    global User createUser(Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        User u = new User();
        handleJit(true, u, samlSsoProviderId, communityId, portalId,
            federationIdentifier, attributes, assertion);
        return u;
    }

    global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        User u = [SELECT Id FROM User WHERE Id=:userId];
        handleJit(false, u, samlSsoProviderId, communityId, portalId,
            federationIdentifier, attributes, assertion);
    }
}
anyone help and comments are much appreciated.

Thank you  
How to query more than two objects in a class ?

Hi i am new to salesforce development.I have 2 standard objects say (Accounts and contacts) and 3 custom objects that are related to each other(Obj1,obj2,obj3).How do i write a query to fetch all the fields from  these 5 objects and display in my visual force page(i have to render as pdf with all these fields)
I am facing an error while trying to establish the Oauth connection (JWT) between talend ETL tool and salesforce :
runtime exception https status 400-bad request message {"error":"invalid_grant","error_description":"audience is invalid"}
Here are the steps I have performed :
  • Downloaded the self signed certificate from salesforce.
  • Created the connected app
  • Used following url to authenticate the user
         https://test.salesforce.com/services/oauth2/authorize? client_id=&     redirect_uri=https://test.salesforce.com/services/oauth2/success& response_type=code
Settings on talend connection:
  • Name : Name of the Connection
  • Connection Type : oAuth
  • Oauth2 flow type : Json web token Flow
  • Issuer : client_Id from connected app
  • Subject : Salesforce userName
  • Expiration in time : 600
  • Keystore : Certificate from salesforce
  • Keystore Password : password for certificate
  • Certificate alias : Name of the certificate.
  • Advanced setting : Salesforce Url :https://test.salesforce.com/services/oauth2
Talend Configuration
Hi,

I would like to know how to write a test class for the custom Jit controller.

Controller:
global class StandardUserHandler implements Auth.SamlJitHandler {
    private class JitException extends Exception{}
    private void handleUser(boolean create, User u, Map<String, String> attributes,
        String federationIdentifier, boolean isStandard) {
        if(create && attributes.containsKey('User.Username')) {
            u.Username = attributes.get('User.Username');
        }
        if(create) {
            if(attributes.containsKey('User.FederationIdentifier')) {
                u.FederationIdentifier = attributes.get('User.FederationIdentifier');
            } else {
                u.FederationIdentifier = federationIdentifier;
            }
        }
        if(attributes.containsKey('User.ProfileId')) {
            String profileId = attributes.get('User.ProfileId');
            Profile p = [SELECT Id FROM Profile WHERE Id=:profileId];
            u.ProfileId = p.Id;
        }
        if(attributes.containsKey('User.UserRoleId')) {
            String userRole = attributes.get('User.UserRoleId');
            UserRole r = [SELECT Id FROM UserRole WHERE Id=:userRole];
            u.UserRoleId = r.Id;
        }
        if(attributes.containsKey('User.Phone')) {
            u.Phone = attributes.get('User.Phone');
        }
        if(attributes.containsKey('User.Email')) {
            u.Email = attributes.get('User.Email');
        }


        if(!create) {
            update(u);
        }
    }

    private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        if(communityId != null || portalId != null) {
            String account = handleAccount(create, u, attributes);
            handleContact(create, account, u, attributes);
            handleUser(create, u, attributes, federationIdentifier, false);
        } else {
            handleUser(create, u, attributes, federationIdentifier, true);
        }
    }

    global User createUser(Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        User u = new User();
        handleJit(true, u, samlSsoProviderId, communityId, portalId,
            federationIdentifier, attributes, assertion);
        return u;
    }

    global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map<String, String> attributes, String assertion) {
        User u = [SELECT Id FROM User WHERE Id=:userId];
        handleJit(false, u, samlSsoProviderId, communityId, portalId,
            federationIdentifier, attributes, assertion);
    }
}
anyone help and comments are much appreciated.

Thank you  
How to query more than two objects in a class ?

Hi i am new to salesforce development.I have 2 standard objects say (Accounts and contacts) and 3 custom objects that are related to each other(Obj1,obj2,obj3).How do i write a query to fetch all the fields from  these 5 objects and display in my visual force page(i have to render as pdf with all these fields)

Find Duplicates button on Leads will find duplicates on which criteria?

I got requirement like on Account detail record create one button called "Find Duplicates".When click on this button  invoke the VF page to display the list of duplicate record matching with the current record.

 

I am dng the account matching based on Account name,website, Country,City

 

Please help me ASAP how to do with Apex class and VF page.....

 

Regards,

Kiran