• PrashanthNeo
  • NEWBIE
  • 104 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Hi,

I had this code working but realized that it really wasn't bulkifyed because I was passing in a single username!  I changed the caller to pass a list as shown below.  The bold areas are what i changed from a String to a LIST string.  Once I did that I started getting an invalid URI error.  Your help is apprecaited - thanks.

public class SandboxManagerCallout {
    @future(callout=true)
    public static void DeactivateUser(String NamedCredential, List<String> UserNames) {
        // The line below is only here to save time during testing by reactivating users.  
        // This should always be set to FALSE in PRODUCTION.
        Boolean isActive = true; 
        String EndPoint = 'callout:' + NamedCredential + '/services/apexrest/SandboxManagerAPI/' + UserNames + '/' + isActive;        
        HttpRequest req = new HttpRequest();        
        req.setEndpoint(EndPoint);
        req.setMethod('POST');
        Http http = new Http();
        req.setHeader('Content-Type', 'application/json;charset=UTF-8');
        req.setBody('{"UserNames":UserNames, "isActive":isActive}');
        HTTPResponse res = http.send(req);
        System.debug('---Response---');
        System.debug(res.getBody());
    }
}


this is the code on the REST API side but the error I get doesn't even make it to this code but thought to show in case...

@RestResource(urlMapping='/SandboxManagerAPI/*')
global with sharing class SandboxManagerAPI {  
    static Boolean isSandboxValidated = false;
    static Boolean isOrgSandbox = false;

   @HttpPost
    global static void doDeactivate() { 
        Integer USER_NAME = 2;
        Integer IS_ACTIVE = 3; 
        if(!issandbox()) return;
        System.debug('---DeactivateUser.doDeactivate()---');
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        System.debug('req: ' + req.requestURI);
        List<String> Parms = req.requestURI.split('/');
        String UserName = parms[USER_NAME];
        String isActive = parms[IS_ACTIVE];
        //String userName = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);      
        System.debug('Username Passed In: ' + UserName);
        System.debug('isACtive passwed In: ' + isActive);
        User user = [SELECT Id, Username, isActive 
                     FROM User 
                     WHERE userName .............................
.............................
I have done the exact same thing as they have said in the module. But some how I am getting error like this: 
Challenge Not yet complete... here's what's wrong: 
Can't find the forceContent:fileUpload Lightning component in the 'New Lead' flow. Make sure the field’s unique name is 'Upload_File'
Though I have named the field as 'Upload_File'!!!

I am attaching the screen shot of how I have done it below..
My flow is also active and is also inclued in the page named "Process Automation Home". I don't know what is wrong. Kindly help me. 

User-added imageUser-added image
User-added image
Challenge Requirements:
Create a flow:
Name: New Lead
Type: Screen Flow
In the flow, add a screen with these required screen fields.
Last Name
Company Name
In the flow, create a lead record.
Use the screen fields to set the lead’s Last Name and Company.
Store the lead’s ID in a Text variable called leadId.
In the flow, add another screen with a Lightning component screen field.
Name the field Upload_File
Choose the forceContent:fileUpload Lightning component.
Use the leadId variable to set the component's Related Record ID attribute.
Activate the New Lead flow.
Create a new Lightning page:
Type: Home page
Label: Process Automation Home
In Process Automation Home, add a Flow component that references the New Lead flow.
Activate the page and set it as the default Home page.

I did all of this and yet it says it cannot detect force content?User-added image
User-added image
Hi Folks,

After running test class, am able to see the percentage of the code covered, but unable to see covered code lines in developer console or any where.

Let me know if any body got this issue, and wat is the get rid of this issue.

Thank you in advance..

Hi, 

 

I written test class and coverage is 91%, i am trying to see while lines are not covered but not able to see developer console. 

 

is it salesforce bug or  i missed something

 

Thanks ,

siva.

I have a visualforce pag where I override the Save command.

 

Since I am overriding the Save command. In the script I utilize the Update DML statement, however I have validation that used to work fine and display the error in my VisualForce page when I used the standard controller.

 

Now I believe I need to re-validate in my code, catch the same error condition and throw the error message to the visualforce page so it shows up where the validation error message normally would.

 

How do I do this?

 

 

Hi,

 

After removing the object level edit and delete permission from the profile. Still I am able to see the Action column in the related list. Is there is any way to remove this Action column?

Is there a work around to incorporate more than 15 steps in an approval process. Our business process is quiet complicated and requires close to 25 steps to cater to the requirements.
  • March 08, 2010
  • Like
  • 3

Hi -

 

I am looking for the fastest way possible to mass delete all records for a given custom object. I developed a very simple Batch Apex class which is described below.  The code works but it performs very slowly. Yesterday it took 40 minutes to delete 34,000 records, although I did not run into any governor limits.  It seems that the execute() call is only receiving a few records at a time.  Is there any way to coax it to process large groups of records?

 

Any help would be greatly appreciated.

 

global class MassDeleteCustomObject implements Database.Batchable<Sobject>

{

  global final String query = 'select Id from <my custom object>';

 

  global Database.QueryLocator start(Database.BatchableContext BC)

  {

 

       return Database.getQueryLocator(query);

  }

 

    global void execute(Database.BatchableContext BC, List<Sobject> records)

   {

        delete records;

   }

 

  global void finish(Database.BatchableContext BC)

  {

  }

 

}

Is there any way to get the profile name of logged in user without querying the user object.

 

I know the following solution:

 

String usrProfileName = [select u.Profile.Name from User u where u.id = :Userinfo.getUserId()].Profile.Name;

 

Instead of this I want to save 1 query so if there is any method to get the profile name in apex without firing the query please let me know.

 

Thanks,