• Niran NS
  • NEWBIE
  • 70 Points
  • Member since 2015
  • Niran NS
  • Cognizant

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
I need to write test class along with test data factory class for the below class, anyone help plz..


public class ApprovalProcessDemoController {

    @AuraEnabled
     public static void submitAndProcessApprovalRequest(String firtTextBoxId) {
        
         ApprovalProcessDemo__c ApprovalObj = new ApprovalProcessDemo__c();
         ApprovalObj.Name = firtTextBoxId;
         //ApprovalObj.First_Value__c = 'Submitted';
         insert ApprovalObj;
         
         User user1 = [SELECT Id FROM User WHERE Alias Like:'%ggarg%' limit 1];
         
         // Create an approval request for the Approval Process Demo
        Approval.ProcessSubmitRequest req1 = 
            new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval.');
        req1.setObjectId(ApprovalObj.Id);
        
          // Submit on behalf of a specific submitter
        req1.setSubmitterId(user1.Id); 
        
        // Submit the record to specific process and skip the criteria evaluation
        req1.setProcessDefinitionNameOrId('Demo_Approval_Process');
        req1.setSkipEntryCriteria(true);
        
        // Submit the approval request for the account
        Approval.ProcessResult result = Approval.process(req1);
        
        // Verify the result
        System.debug('+++++ :' +result.isSuccess());
         System.debug('+++++ Pending:' +result.getInstanceStatus());
          System.debug('+++++ :' +result.getInstanceStatus());
         
        
        // Approve the submitted request
        // First, get the ID of the newly created item
       /* List<Id> newWorkItemIds = result.getNewWorkitemIds();
        
        // Instantiate the new ProcessWorkitemRequest object and populate it
        Approval.ProcessWorkitemRequest req2 = 
            new Approval.ProcessWorkitemRequest();
        req2.setComments('Approving request.');
        req2.setAction('Approve');
        req2.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        
        // Use the ID from the newly created item to specify the item to be worked
        req2.setWorkitemId(newWorkItemIds.get(0));
        
        // Submit the request for approval
        Approval.ProcessResult result2 =  Approval.process(req2);
        
        // Verify the results
        System.debug(result2.isSuccess() + '  Result Status :  ' +result2.isSuccess());
        
        System.debug(  'Approved   -   '+ result2.getInstanceStatus()); 
           System.debug( 'Instance Status -   '+result2.getInstanceStatus());         
     */    
      
    }
    
}
I am working on deploying Snap-Ins chat to our website, including within our web-app and I want to be able to pass values from our logged in users into pre-chat fields in Live Agent. I found this documentation and pasted the code from the article in as a test in our sandbox, but when I do that the chat button goes away, so I can't even get to the pre-chat form.

Help article: https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_populate_prechat.htm

All I'm doing is going to the chat button code, un-commenting the embedded_svc.settings.prepopulatedPrechatFields" line, and pasting in the following below it:
embedded_svc.settings.prepopulatedPrechatFields = {
FirstName: “John”,
LastName: “Doe”,
Email: “john.doe@salesforce.com”,
Subject: “Hello” };

Any help is much appreciated.
I need to write test class along with test data factory class for the below class, anyone help plz..


public class ApprovalProcessDemoController {

    @AuraEnabled
     public static void submitAndProcessApprovalRequest(String firtTextBoxId) {
        
         ApprovalProcessDemo__c ApprovalObj = new ApprovalProcessDemo__c();
         ApprovalObj.Name = firtTextBoxId;
         //ApprovalObj.First_Value__c = 'Submitted';
         insert ApprovalObj;
         
         User user1 = [SELECT Id FROM User WHERE Alias Like:'%ggarg%' limit 1];
         
         // Create an approval request for the Approval Process Demo
        Approval.ProcessSubmitRequest req1 = 
            new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval.');
        req1.setObjectId(ApprovalObj.Id);
        
          // Submit on behalf of a specific submitter
        req1.setSubmitterId(user1.Id); 
        
        // Submit the record to specific process and skip the criteria evaluation
        req1.setProcessDefinitionNameOrId('Demo_Approval_Process');
        req1.setSkipEntryCriteria(true);
        
        // Submit the approval request for the account
        Approval.ProcessResult result = Approval.process(req1);
        
        // Verify the result
        System.debug('+++++ :' +result.isSuccess());
         System.debug('+++++ Pending:' +result.getInstanceStatus());
          System.debug('+++++ :' +result.getInstanceStatus());
         
        
        // Approve the submitted request
        // First, get the ID of the newly created item
       /* List<Id> newWorkItemIds = result.getNewWorkitemIds();
        
        // Instantiate the new ProcessWorkitemRequest object and populate it
        Approval.ProcessWorkitemRequest req2 = 
            new Approval.ProcessWorkitemRequest();
        req2.setComments('Approving request.');
        req2.setAction('Approve');
        req2.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        
        // Use the ID from the newly created item to specify the item to be worked
        req2.setWorkitemId(newWorkItemIds.get(0));
        
        // Submit the request for approval
        Approval.ProcessResult result2 =  Approval.process(req2);
        
        // Verify the results
        System.debug(result2.isSuccess() + '  Result Status :  ' +result2.isSuccess());
        
        System.debug(  'Approved   -   '+ result2.getInstanceStatus()); 
           System.debug( 'Instance Status -   '+result2.getInstanceStatus());         
     */    
      
    }
    
}
I have a web app that requires authentication. ?| I would like to link it to salesforce to provide a single sign on. ?| My use case is this :

- User logs into salesforce
- User clicks on a link for a connected app and then goes to my web app page
- Because the user is already logged in, the user should not have to log in again

So a single sign on solution with oauth seems like a good solution. ?| However, all the discussions I see are from the perspective of the user starting on my app page and then redirecting to salesforce to do the auth. ?| I want to start on my 
salesforce app launcher page (with authentication as needed) and then go to the app page.

When the user gets to my app page, I do not know if they have a session and I need a way to check if they have a session through a query to salesforce. ?| I know I can do this by going through the oauth flow but I would rather not redirect the
m to salesforce just to have the site redirect the user back as this would be a bad user experience. ?| I believe I can use a hidden iframe to do this cycle but this seems like a lot of work that could be avoided if the original link from sale
sforce to my app page just included the user's current session token (or any token that can be linked to the user's current session)

With the app launcher and the connected apps, I assume that this cannot be unique problem so can someone point me in the right direction on how to get this working. ?| Is there some way to configure the connected app to include session informa
tion as part of the link or is there another recommended way of sharing the session FROM salesforce to the connected app ?
Hi,

I'm trying to validate step 5 for the Security Specialist superbadge "Set up reporting error" and I'm geeting the following error :

Challenge Not yet complete... here's what's wrong:
The Field Sales User profile does not appear to have the correct permission for create and customize reports.

I don't understand what's wrong cause I've check all reports permissions on the Field Sales User profile.

Could you please advice ?

Thanks.