• Marco Sozzi 5
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hello,
is there a way to distinguish (in a trigger or other)  if a checkbox field has been populated by the user or by the system with a defult value? I have a checkbox with default value Unchecked (false). When the object is saved the field containd FALSE value and i have to distinguish if the user has inserted it or if the user has not inserted any value for the field (null) and the system has put the default value.

Thank you.
Marco.
Hello,
is there a way to distinguish (in a trigger or other)  if a checkbox field has been populated by the user or by the system with a defult value? I have a checkbox with default value Unchecked (false). When the object is saved the field containd FALSE value and i have to distinguish if the user has inserted it or if the user has not inserted any value for the field (null) and the system has put the default value.

Thank you.
Marco.
Hi All,

I'm trying to get the properties of the current session in a trigger on the Contact object by calling:
Map<String,String> sessionAttributes  = Auth.SessionManagement.getCurrentSession();

This works fine when I'm logged in with the System Administrator profile.
But, when I try to log in and run as a Salesforce Platform user it throws a System.UnexpectedException.
This is the debug log showing the error (the code on line 9 of the trigger is the call to getCurrentSession shown above):
26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
11:56:43.306 (306104471)|EXECUTION_STARTED
11:56:43.306 (306155227)|CODE_UNIT_STARTED|[EXTERNAL]|TRIGGERS
11:56:43.306 (306192631)|CODE_UNIT_STARTED|[EXTERNAL]|01q90000000BEmh|OnePlace.trContactBF on Contact trigger event BeforeInsert for [new]
11:56:43.307 (307728017)|SYSTEM_METHOD_ENTRY|[7]|system.Test.isRunningTest()
11:56:43.307 (307815791)|SYSTEM_METHOD_EXIT|[7]|system.Test.isRunningTest()
11:56:43.316 (316249510)|SYSTEM_METHOD_ENTRY|[9]|Auth.SessionManagement.getCurrentSession()
11:56:43.339 (339522821)|SYSTEM_METHOD_EXIT|[9]|Auth.SessionManagement.getCurrentSession()
11:56:43.339 (339710389)|FATAL_ERROR|System.UnexpectedException: Salesforce System Error: 1915389216-15189 (-1293247755) (-1293247755)

(System Code)
********************: line 9, column 1
11:56:43.339 (339734369)|FATAL_ERROR|System.UnexpectedException: Salesforce System Error: 1915389216-15189 (-1293247755) (-1293247755)

(System Code)
********************: line 9, column 1
11:56:43.174 (339797975)|CUMULATIVE_LIMIT_USAGE
11:56:43.174|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

11:56:43.174|CUMULATIVE_LIMIT_USAGE_END

11:56:43.339 (339878387)|CODE_UNIT_FINISHED|******************** on Contact trigger event BeforeInsert for [new]

Any ideas as to what's going wrong?
Hi,

I have 2 users A and B. User A has Admin profile and so has the option to login as other users.

Now lets say, User A logged into the system and logged in as User B. 
Now, when I try to get the loggen in user Id using Userinfo.getUserId() or any other apex method, I get the User B record id. 

Is there a way, I can get the actual logged user i.e., User A record Id