• Manmohan Singh
  • NEWBIE
  • 70 Points
  • Member since 2014
  • Senior Consultant CRM
  • Cognizant

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 16
    Replies
Hi Everyone,

In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?

 
Hi Expert,

How can insert value in custom textfiled. when i used insert method then facing error. I am sharing error screen shot.

User-added imageUser-added image 

Please suggest.

Thanks
Mukesh
Hi All,

    How to restrict non-admin user to delete the opportunity team members it allows for delete the active team members and disallow for inactive team members?

Thanks In Advance,
Basha
 
I have this trigger and I want to change it to select 1 Gateway ID if the currency of the Opportunity is x and if the Brand on the product is Y ( Through Opportunity Product and Product) or select Gateway 2 if something else etc

trigger UpdateGateway on OpportunityLineItem (after insert, after update) {

 
 Id GatewayId = 'a012000001k5yoK'; 
Set<id>ids=new set<id>();

list<opportunity> oplst=new list<opportunity>();

    For(OpportunityLineItem ol:trigger.new){
        if(ol.Continuity__c == True){
            ids.add(ol.opportunityid);
        }

    }

    if(!ids.Isempty()){

        list<opportunity >opp=[select id,CSFA__Gateway__c from Opportunity where id in:ids];

        for(Opportunity op:opp){

                op.CSFA__Gateway__c= GatewayId;
           
                oplst.add(op);

            }

        

        update oplst;

    }  

}
Hi,

 In below visualforce page i tried adding immediate = true in button also in  <apex:actionRegion immediate="true"> but this is not working can you please suggest me how to by pass the opportunity validation message 
<apex:page standardController="Opportunity" extensions="OptyLineEditCnt" id="pg" sidebar="false" docType="html-5.0">
    <style>
        .oddprnv {
        background-color: #FFFFFF;
        }
        .evenprnv {
        background-color: #f4efbc;
        }
        
       .txtalign{
       text-align:center;
       }
       .wdh{
            width:36%;
       }

    </style>
    
    
    <script>
    function inputLimiter(e,allow) {
        var AllowableCharacters = '';
        
        if (allow == 'Letters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';}
        if (allow == 'Numbers'){AllowableCharacters='1234567890';}
        if (allow == 'NameCharacters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.\'';}
        if (allow == 'NameCharactersAndNumbers'){AllowableCharacters='1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-\'';}
        if (allow == 'Currency'){AllowableCharacters='1234567890.';}
        
        var k = document.all?parseInt(e.keyCode): parseInt(e.which);
        if (k!=13 && k!=8 && k!=0){
            if ((e.ctrlKey==false) && (e.altKey==false)) {
                return (AllowableCharacters.indexOf(String.fromCharCode(k))!=-1);
            } else {
                return true;
            }
        } else {
            return true;
        }
    }
    
 function isNumberKey(sender, evt) { 
    var txt = sender.value; 
    var dotcontainer = txt.split('.'); 
    var charCode = (evt.which) ? evt.which : event.keyCode; 
    if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57)) 
        return false;

    return true; 
}
       
          
  </script>
  
  <script>
     function displayImage(value,index) {
          
      var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow");
                  
         if ( value == true )   
         {      
         yellow.style.display = 'block';
         }
         else
         {
          yellow.style.display = 'none';
          }
                   
     }
     
      function displayImagesp(index) {
                 
       var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow");
                  
      yellow.style.display = 'block';
                   
     }
     
      function displayImagedr(index) {
                 
       var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow");
                  
        yellow.style.display = 'block';
                   
     }
     
      function displayImagedrr(index) {
                 
       var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow");
                  
       yellow.style.display = 'block';
                   
     }
     
      
   function discountlimit(value,index){
    
       if(value <0 || value >100)
       {
         document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrDiscountRate").innerHTML = 'Discount must be no more than 100';
         document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").style.color = 'RED';
         document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").value = '';
        }
       else
        {
          document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrDiscountRate").innerHTML = '';
          document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").style.color = 'BLACK';
         }    
   }   
      
      
   function resellerdiscountlimit(value,index){
    
       if(value <0 || value >100)
       {
         document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrResellerDiscountRate").innerHTML = 'Discount must be no more than 100';
         document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").style.color = 'RED';
         document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").value = '';
        }
       else
        {
          document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrResellerDiscountRate").innerHTML = '';
          document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").style.color = 'BLACK';
         }     
   }      
       
       
   function GrandTotalPrice(){
      alert('sudhir' + document.getElementById("pg:frm:pb2:pbt2:"+0+":TotalPrice").value );
      
      var Gtot = document.getElementById("pg:frm:pb2:pbt2:"+0+":TotalPrice").value;
      
      document.getElementById("pg:frm:pb2:pbt2:"+5+":TotalPrice").innerHTML = '1';
  
   }
   
   
   function fltrdiscountrate(){
     var value; 
      value = document.getElementById("pg:frm:pb2:prodcatdiscount").value; 
      if(value <0 || value >100)
       {
        alert('Discount cannot be more than 100');
        document.getElementById("pg:frm:pb2:prodcatdiscount").value = '';  
        document.getElementById("pg:frm:pb2:prodcatdiscount").style.color = 'RED';
       }      
   }
   
   function checkdiscountrate(){
   
    var value; 
    value = document.getElementById("pg:frm:pb2:prodcatdiscount").value; 
    if(value == "")
    {
      alert('You have applied blank value to discount');
     }
   
   }
   
  function selectCheckboxes(inpt,receivedInptID)
   {
     var inputCheckBox = document.getElementsByTagName("input");                  
     for(var i=0; i<inputCheckBox.length; i++)
      {          
       if(inputCheckBox[i].id.indexOf(receivedInptID)!=-1){                                     
          inputCheckBox[i].checked = inpt.checked;
       }
     }
   }

 
  </script>
    
  <script>
  var counter = 0;

  function incrementCounter(checked) {
      if (checked) {
          counter++;
      } else {
          counter--;
      }
  }

  function incrementcheckall(val,checked){
   if (checked) {
     counter = val;
    }
    else
    {
    counter = 0;
    }
  }
  
  function DeleteConfirmation(val) {
       if ( counter == 0 )
       {
        alert('Please select at least one Product to delete');      
        }
       else
       {
      return confirm('Number of records selected ' + counter + ' out of ' + val);
        }
  }
  </script>
    
     <apex:form id="oppfrm">
          <apex:pageBlock title="Opportunity Details">
         <apex:pageBlockSection columns="2"  >

           <apex:outputField style="font-weight:500"  value="{!opportunity.name}"/> 
           <apex:outputField style="font-weight:500"  value="{!opportunity.stagename}"/> 
           <apex:outputField style="font-weight:500"  value="{!opportunity.closedate}"/>
           <apex:outputField style="font-weight:500"  value="{!opportunity.Distributor__c}"/> 
         <!--  <input id="theHiddenInput" type="hidden" name="theHiddenInput" /> -->
           <apex:outputField style="font-weight:500" label="Original Amount" value="{!opportunity.amount}"/> 
           <apex:outputText id="differenceamount" style="font-weight:500" label="Differnce Amount" value="${0, number, ###,##0.00}">  
           <apex:param value="{!differenceamount}"/>
           </apex:outputText>
          
          
          </apex:pageBlockSection>
       </apex:pageBlock>
     </apex:form>
               
    <apex:form id="frm">
    
        <apex:actionRegion immediate="true">
              
        <apex:pageBlock title="Edit Opportunity Products" id="pb2">
 
            <apex:pageBlockButtons id="pgbutn" >
                <apex:commandButton value="Quick Save" action="{!quicksavelns}" style="background:LightBlue;width:85px;" title="Help" immediate="true"/>
                <apex:commandButton value="Save & Close" action="{!savelns}"  style="background:LightBlue;width:85px;" title="Help" immediate="true"/>
                <apex:commandButton value="Delete" action="{!deletelns}" onclick="if(!DeleteConfirmation({!numberofrecords})){return false};" style="background:LightBlue;width:85px;" title="Help" immediate="true"/>
                <apex:commandButton action="{!cancelbtn}" value="Cancel" style="background:LightBlue;width:85px;" title="Help"/>  
                <apex:commandButton action="{!refreshbtn}" value="Reset All" onclick="if(!confirm('Are you sure you want to undo all changes?')){return false};" style="background:LightBlue;width:85px;" title="Help" immediate="true"/> 
       
               </apex:pageBlockButtons>
               
               <apex:panelGrid columns="3" id="theGrid" columnClasses="wdh">
                    <apex:outputText />
                    <apex:panelGroup >
                
                 <apex:outputText value="Product Category"/>
                 &nbsp;&nbsp;&nbsp;
                 <apex:selectList size="1" value="{!selectlistvalue}" label="Product Category" style="width:80px;">
                 <apex:selectOptions value="{!ProdCatList}"></apex:selectOptions>
                 </apex:selectList>
                 &nbsp;&nbsp;&nbsp;
                 <apex:outputText value="Discount"/>
                 &nbsp;&nbsp;&nbsp;
                <apex:inputText id="prodcatdiscount" value="{!prodcatdiscount }" label="Product Discount"  style="width:50px;" 
                                onkeypress="return isNumberKey(this, event);" onkeyup="fltrdiscountrate();"/>
               &nbsp;&nbsp;&nbsp;
               <apex:commandButton action="{!applydscnt}" value="Apply" onclick="if(!confirm('Apply discount to all products of that category?')){return false};" style="background:LightBlue;width:80px;"/>  <!-- onclick="checkdiscountrate(); -->
                     </apex:panelGroup> 

                </apex:panelGrid>

                <apex:pageBlockTable rowClasses="evenprnv, oddprnv" value="{!lineWrapr}" var="l" Width="100%" id="pbt2">
 
                  <apex:variable var="index" value="{!0}" id="oppIndex" />
                  <apex:variable var="indexsp" value="{!0}" id="oppIndexsp" />
                  <apex:variable var="indexdr" value="{!0}" id="oppIndexdr" />
                  <apex:variable var="indexdrr" value="{!0}" id="oppIndexdrr" />       
                     
                    <apex:column >
                       <apex:facet name="header">
                       <apex:inputCheckbox onclick="selectCheckboxes(this,'inputId'), incrementcheckall({!numberofrecords},this.checked)"/>
                        </apex:facet>
                        <apex:inputCheckbox id="inputId" title="Delete" value="{!l.selected}" onclick="incrementCounter(this.checked);">
                        </apex:inputCheckbox>
                    </apex:column>
                   
                    <apex:column headerValue="Product" style="width:35%;text-align:left;">
                        <apex:outputLink target="_blank" value="/{!l.line.Product2Id}">{!l.line.PricebookEntry.product2.name}</apex:outputLink>
                    </apex:column>
                    
                     <apex:column headerValue="Product Code" >
                        <apex:outputLink target="_blank" value="/{!l.line.Product2Id}">{!l.line.PricebookEntry.productcode}</apex:outputLink>
                    </apex:column>
                    
                    <apex:column headerValue="Product Category" style="text-align:center;">  
                    <apex:outputText value="{!l.line.PricebookEntry.product2.Category__c}">   </apex:outputText> 
                    </apex:column>
 
                    <apex:column headerValue="List Price">
                        <apex:inputfield id="ListPrice1" value="{!l.line.listprice}" rendered="{!l.line.PricebookEntry.name != 'COTERM'}" style="width:50px"></apex:inputfield>
                        <apex:inputfield id="ListPrice2" required="true" value="{!l.line.CoTerm_List_Price__c}" 
                                                         rendered="{!l.line.PricebookEntry.name == 'COTERM'}" 
                                                         OnKeyPress="return isNumberKey(this, event);" 
                                                         style="width:50px">
                         <apex:actionSupport event="onchange" 
                                                action="{!calcOnSalchange}" 
                                                rerender="DiscountRate,TotalPrice,ResellerDiscountRate,GrandTotalPrice,editstatus" status="assigncoterm" />
                            <apex:actionStatus id="assigncoterm" 
                                               startText="updating.." 
                                               stopText=""/>                                                                  
                       </apex:inputfield>
                        
                    </apex:column>
                    
                    <apex:column headerValue="Quantity" style="text-align:center;">
                     
                        <apex:inputfield id="Quantity"  value="{!l.line.Quantity}" OnKeyPress="return inputLimiter(event,'Numbers');" Onkeyup="displayImage({!l.line.Quantity},{!index-1});" style="width:60px">
                            <apex:actionSupport event="onchange" 
                                                action="{!calcOnQntchange}" 
                                                rerender="Quantity,TotalPrice,GrandTotalPrice,editstatus,oppfrm" status="assign1" />
                            <apex:actionStatus id="assign1" 
                                               startText="updating.." 
                                               stopText=""/>
                        </apex:inputfield>
                        
                       <apex:variable var="index" value="{!index + 1}" /> 
   
                    </apex:column>
                    
                    <apex:column headerValue="Sales Price" style="text-align:center;">
                       
                        <apex:inputfield id="Unitprice" required="true" value="{!l.line.UnitPrice}" OnKeyPress="return isNumberKey(this, event);" onkeyup="displayImagesp({!indexsp-1});" style="width:60px">
                            <apex:actionSupport event="onchange" 
                                                action="{!calcOnSalchange}" 
                                                rerender="DiscountRate,TotalPrice,ResellerDiscountRate,GrandTotalPrice,editstatus,oppfrm" status="assign2" />
                            <apex:actionStatus id="assign2" 
                                               startText="updating..." 
                                               stopText=""/> 
                        </apex:inputfield>       
                        <apex:variable var="indexsp" value="{!indexsp + 1}" />                                    
                    </apex:column>
                    
                    <apex:column headerValue="Disti Discount" style="text-align:center;">
                        <apex:inputfield id="DiscountRate" value="{!l.line.Discount_rate__c}"  OnKeyPress="return isNumberKey(this, event);" 
                                             onkeyup="discountlimit(this.value,{!indexdr-1}); displayImagedr({!indexdr-1});" style="width:60px">
                            <apex:actionSupport event="onchange" 
                                                action="{!calcOnDistchange}" 
                                                rerender="Unitprice,ResellerDiscountRate,editstatus" status="assign3" />
                            <apex:actionStatus id="assign3" 
                                               startText="updating.." 
                                               stopText=""/> 
                          </apex:inputfield> 
                        <apex:outputText id="ErrDiscountRate" value="" />                      
                         <apex:variable var="indexdr" value="{!indexdr + 1}" />                             
                    </apex:column>
                    
                    <apex:column headerValue="Reseller Discount Rate" style="text-align:center;">
                        <apex:inputfield id="ResellerDiscountRate" value="{!l.line.Reseller_discount_rate__c }" OnKeyPress="return isNumberKey(this, event);"  
                                          onkeyup="resellerdiscountlimit(this.value,{!indexdrr-1}); displayImagedrr({!indexdrr-1});"  style="width:60px" >
                            <apex:actionSupport event="onchange" 
                                                action="{!callDistSaleMth}" 
                                                rerender="DiscountRate,Unitprice,editstatus" status="assign4" />
                            <apex:actionStatus id="assign4" 
                                               startText="updating.." 
                                               stopText=""/> 
                        </apex:inputfield>
                        <apex:outputText id="ErrResellerDiscountRate" value="" />   
                      <apex:variable var="indexdrr" value="{!indexdrr + 1}" />     
                       <apex:facet name="footer">
                        <apex:outputText value="Grand Total"/>
                        </apex:facet>        
                    </apex:column>       
                    
                    <apex:column headerValue="Total Price">
                        <apex:outputfield id="TotalPrice" value="{!l.line.TotalPrice}"/>
                        <apex:facet name="footer">
                        <apex:outputText id="GrandTotalPrice"  value="${0, number, ###,##0.00}">            
                        <apex:param value="{!grandtotal}"/>
                        </apex:outputText>
           
                        </apex:facet> 
                    </apex:column>
                    
                <!--  <apex:column headerValue="Status" width="3%" id="status">
                  <apex:image alt="" url="{!URLFOR($Resource.ForecastingTab,'forecastdata/images/yellow-bullet.png')}"
                                                id="oppStatusYellow"
                                                title="This opportunity has pending updates and will be updated when save button is clicked."
                                                 style="display:none;"/>
                 </apex:column>  -->
    
                  <apex:column headerValue="Status" width="3%" id="editstatus">
                 
                       <apex:image url="{!URLFOR($Resource.ForecastingTab, 'forecastdata/images/yellow-bullet.png')}"  rendered="{!l.editcheck}"/> 
                            
                 </apex:column> 
                 
                </apex:pageBlockTable>
                  
          
        </apex:pageBlock>
              </apex:actionRegion>    
    </apex:form>       
        
</apex:page>

Thanks
Sudhir
  • October 24, 2016
  • Like
  • 0

Hi Everyone,

I am using the developer edition and my question is regarding adding multiple If statements to formulas within an object. 

I am trying to write a formula to assign a value to certain feilds so I can create a score for each account and rate them base on the score.
For example, one of the creiteria for the score is a feild name, "Number of properties" which happens to be 30 I want to assign a score of 25.
using if :  IF(logical_test, value_if_true, value_if_false) 
Heres what i got so far: 
IF((number_of_property__c <= 5), 5, 0)
IF((5 < number_of_property__c) <= 10), 10, 0)
IF((10 < number_of_property__c) <= 20),15, 0)
IF((20 < number_of_property__c) <= 30),20, 0)
IF((30 < number_of_property__c)),25, 0)

i keep getting a "Error: Syntax error. Extra IF" on the second IF on line 2

if there is a better way to do this or if you know why im getting this error please let me know anything helps

  • October 18, 2016
  • Like
  • 0
Hi there, I just started using Eclipse IDE..
So Rookie for it. Can some one guide me ,
how can i switch to my differant Orgs Using one single Eclipse IDe on my Machine?
Thank you .
Tejal.
I need to update a custom object with the Campaign Member records whenever a campaign member is inserted or updated. A Campaign Member can be either a Lead type or  Contact type. After a Campaign Member which is of  type Lead is inserted to the Custom Object, if that corresponding Lead is getting converted, then the Campaign Member type changes to Contact, but my Custom Object is not getting updated. Im stuck here.
Can anyone guide me through this issue ?
Here two objects are used.Account and Schedule__c.
The main block's code is called by before trigger on account.
Trigger is on Account object.
It is not allowing me to update the Schedule__c object .

Please let me know why this error is encountered.


Error : 
Error:Apex trigger Account caused an unexpected exception, contact your administrator: Account: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0JM0000007bp55MAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Schedule: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a05M000000ACmimIAD; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 001M000000uSEuz) is currently in trigger Account, therefore it cannot recursively update itself: [] Class.ScheduleTrigger.updateCallsForSchedule: line 63, column 1 Trigger.Schedule: line 11, column 1: []: Class.AccountTrigger.NextCallCycleCheck: line 248, column 1

Main Block :
system.debug('Inside 6week block ');
                 a.REX_Call__c=false;
                 boolean acctNextCycle = a.Next_Cycle_Call__c;
                 List<Schedule__c> wk6Schedules = new list<Schedule__c>();

                 if(a.Priority_Cycle_Frequency__c == 'K: 6 Week Cycles: Weeks 1-2' || a.Priority_Cycle_Frequency__c == 'L: 6 Week Cycles: Weeks 3-4' || a.Priority_Cycle_Frequency__c == 'M: 6 Week Cycles: Weeks 5-6'){
                        system.debug('Inside 6week if block ');
                     for(Schedule__c schedule : [SELECT Id,Store__c,Week__c FROM Schedule__c WHERE Active__c = 'Y' AND Status__c = 'Active' AND Route__r.Status__c = 'Active' AND Store__r.Active__c = 'Y'  AND Store__c =: a.Id]){
                           system.debug('Inside schedule for loop ');
                        if (schedule.Week__c == 1 || schedule.Week__c == 2){
                               system.debug('Inside if block of week 1 and 2 ');
                            if (!acctNextCycle){
                                   system.debug('Inside nextcall true ');
                                reverseAcctNextCycleCall(a);
                            }else{
                                system.debug('Inside nextcall false ');
                                wk6Schedules.add(update6wkSchedule(schedule));
                            }
                        }else if (schedule.Week__c == 3 || schedule.Week__c == 4){
                            system.debug('Inside if block of week 3 and 4 ');
                            reverseAcctNextCycleCall(a);
                            wk6Schedules.add(update6wkSchedule(schedule));
                        }    
                     }
                     System.debug('all schedules to update are ...'+ wk6schedules);   
                     if (wk6Schedules.size() > 0) {
                         database.update(wk6Schedules);
                     }

Functions used in main block :
public static Account reverseAcctNextCycleCall(Account account){
         system.debug('Inside reverseAcctNextCycleCall ');
      Account schedAcct = new Account();
      schedAcct = account;
      if (schedAcct.Next_Cycle_Call__c){
        schedAcct.Next_Cycle_Call__c = false;
      }else{
        schedAcct.Next_Cycle_Call__c = true;
      }
        system.debug('New next cycle call :'+schedAcct.Next_Cycle_Call__c);
        system.debug('Exiting reverseAcctNextCycleCall');
      
      return schedAcct;
    }
    
    public static Schedule__c update6wkSchedule(Schedule__c sched){
    // if wk=1or2, +2 , if wk=3or4, -2
    system.debug('inside update6wkSchedule');
    Schedule__c schedule = sched;
    Decimal existingWk = schedule.Week__c;
    system.debug('Existing week : '+existingWk);
    Decimal newWk = 0;
    if (existingWk == 1 || existingWk == 2){
         newWk = existingWk + 2;
    }else if (existingWk == 3 || existingWk == 4){
         newWk = existingWk - 2;
    }else{
         return schedule;
    }
    schedule.Week__c = newWk;
        system.debug('New week : '+newWk+'schedule.Week__c : '+schedule.Week__c);
    return schedule;
  }


 
Vf page
<apex:selectList size="1" value="{!selResult}" >
<apex:selectOptions value="{! selOptions}" />
</apex:selectlist>
<apex:commandButton value="Go!" action="{!movingtoanotherpage}" />

controller

 Public pagereference movingtoanotherpage(){
     
    if(Selresult=='Create Account'){
    
    PageReference pageRef = new PageReference('/apex/YesBankAccountPage');
          Pageref.setredirect(true);
            return pageRef;
   }
    return null; 
  }
It is not showing any errors even though pagereference is not working
 
Hi Everyone,

In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?

 
Having trouble with reports. I can´t find the option to create Report and DashBoard Folders, nor schedule Reports.
Does anyone knows how to do that?
The number of user that can be created using force.com licenses are less and the users created with work.com and others cannot be assigned permission sets. This is too bad. Can anyone please suggest how you created users (including the license type used while creating each user)?
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