You need to sign in to do that
Don't have an account?
Keer Yenduri
Developer console code
public with sharing class DemoController
{
String LoggedInUserId;
public DemoController(ApexPages.StandardController controller)
{
LoggedInUSerId = UserInfo.getUserId();
}
}
in this program i want to execute in developer console:
i wrote like this
DemoController obj =new DemoController();
but it's not getting
{
String LoggedInUserId;
public DemoController(ApexPages.StandardController controller)
{
LoggedInUSerId = UserInfo.getUserId();
}
}
in this program i want to execute in developer console:
i wrote like this
DemoController obj =new DemoController();
but it's not getting
public with sharing class DemoController
{
String LoggedInUserId;
public DemoController()
{
LoggedInUSerId = UserInfo.getUserId();
System.debug('the output'+LoggedInUserId);
}
}
and in developer console:
DemoController obj =new DemoController();
the result is:
|the output00590000002t5qQAAQ
My Question is whther the output is right or wrong how can i find?
All Answers
In your main class constructor has a controller as a parameter,so while invoking you need to something like below:
DemoController obj =new DemoController(instanceOfStadardController);
Thanks,
Santosh
i got this error in developer console
1.Variable does not exist: instanceOfStadardController
make ur main class as
public with sharing class DemoController
{
String LoggedInUserId;
public DemoController()
{
LoggedInUSerId = UserInfo.getUserId();
}
}
and then run as
DemoController obj =new DemoController();
thanks,
Santosh
i did the same but i could not see the result
public with sharing class DemoController
{
String LoggedInUserId;
public DemoController()
{
LoggedInUSerId = UserInfo.getUserId();
System.debug('the output'+LoggedInUserId);
}
}
and in developer console:
DemoController obj =new DemoController();
the result is:
|the output00590000002t5qQAAQ
My Question is whther the output is right or wrong how can i find?
1. One way to check if you fetched the correct user information would be to append the id to your URL
https://.......salesforce.com/<id printed in debug log - 00590000002t5qQAAQ>
This should take you to the particular User's profile.
2. You can also fetch the user information and confirm by executing the following in the query editor in the Developer console ->
SELECT Name from User where Id = '00590000002t5qQAAQ'
Regards,
Lakshmi.