• Tan J
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies
I have a VF page with readonly attribute set to true. As per documentation, action methods called from this page cannot perform DML operation. However, is DML operation possible if I call a method with @RemoteAction On click of a button on this page? I am able to check/select few records from the table on my VF page and update some field values for selected records by calling @remoteAction method via js remote call on click of a button.
  • July 06, 2016
  • Like
  • 0
I am in process of designing a solution which takes care of many post deactivation tasks when salesforce user is deactivated. For example, reassigning records, removing user from public groups & queues etc. As part of this, I also want to check if user is part of any approval process as an approver. I have an faint idea on how I am going to approach this but just checking with community if there is any recommended way (through apex, customization or any third party tool).
  • July 05, 2016
  • Like
  • 0
I have two objects A & B.  B is child of A in lookup relationship. There are existing complex triggers on both of these objects. One of the thing which trigger on object A does is whenever field xyz changes; it updates all the child object B records with the new value of field xyz. (Both of these objects have field xyz which is long text area.)
As per new requirement, I have to track field history for both of the above objects in custom object (history object C). So I wrote some complex logic to track the history which gets called from object A and Object B trigger. This works fine except one scenario where if I change field xyz on object A and one of the  object B child record is erroneous (data does not meet vaidations - coded in before trigger). In this case my history records are not created for any of these object B child records including erroneous and non-erroneous records. When I put debug after insert statements, I can see that even SF ID's are created for these history records. When I search a record with that SF ID , it says that 'the data you are trying to access could not be found...'. (Note: I use some static maps to avoid duplicate history record creation because of recursive trigger; in case if it matters).  Please let me know if anyone has come across this situation before.
  • February 14, 2016
  • Like
  • 0
 I have a basic question. I have a big VF page with many sections which render/hide based on some flags. The flags are set in constructor of controller extension and are mostly depend on the logged-in user profile, role etc. (i.e. they do not change value). Now I am trying to make my constructor thin and move these flags outside it in getter/setter methods. However, I want to know if these getters will always be called when they are referenced in 'rendered' on multiple sections etc. (i.e. the flags are referred in VF page multiple times). When I did some testing, it looks like they are called only first time but want to confirm my understanding. With the flags being set in constructor, I am assured that they will run only once when the page loads. But I want to reduce the code in constructor.
  • October 24, 2015
  • Like
  • 0
I want to know if I can use javascript in place of apex:page action. I am implementing js remoting in my vf page. I am going to add @remoteaction before my pagereference method in controller. I also know how to call a @remoteaction method in vf page using javascript for implementing js remoting. However, I am not sure how i can replace action in the apex:page tag which gets called when the vf page loads and performas redirection based on who the logged -in user is (this logic is handled in pagerefernce method in controller).
  • October 22, 2015
  • Like
  • 0
I want to know the best optimized way to access current logged in user's information and set few flags. I have a controller extension and I have set flags in constructor like this:

 User u = [SELECT ID,Name,ProfileID,Profile.Name,UserRole.Name,UserRole.ID,Team_Lead__c,Leading_Teams__c,Department,Desk__c
             FROM User 
             WHERE id=:userId];

if(u.UserRole.Name != null && u.UserRole.Name.contains('xyz')){
                isComUser = true;
      }      
            if(u.UserRole.Name != null && u.UserRole.Name.contains('pqr'))   { 
                isFPUser = true; 
}


...and the conditions go on..
There are so many conditions that constructor has become really big & unmanagable.

Is there a good way to do this? Thanks in advance
  • October 21, 2015
  • Like
  • 0
I have parent object A and child object B. I queried object A and  passed query  through getquerylocator in start method of batch apex. I do lot of custom code in execute method and then create a list of new child records for inserting. When I do insert, I receive DML error saying that I cannot insert more than 10k records. I am trying to find solution for this. Here is what I have thought till now. 1) do whatever custom logic outside batch apex and pass list of newly created child records to start method. But how should I do that? Start method only accepts soql query or iterator 2) tried implementing iterable but was not able to do it. Now Need your help to understand how should I solve this problem. To put it in one sentence- I have a list of more than 10k records to insert. How should I do it through batch apex? Thank you!!
  • September 20, 2014
  • Like
  • 0
I have two objects A & B.  B is child of A in lookup relationship. There are existing complex triggers on both of these objects. One of the thing which trigger on object A does is whenever field xyz changes; it updates all the child object B records with the new value of field xyz. (Both of these objects have field xyz which is long text area.)
As per new requirement, I have to track field history for both of the above objects in custom object (history object C). So I wrote some complex logic to track the history which gets called from object A and Object B trigger. This works fine except one scenario where if I change field xyz on object A and one of the  object B child record is erroneous (data does not meet vaidations - coded in before trigger). In this case my history records are not created for any of these object B child records including erroneous and non-erroneous records. When I put debug after insert statements, I can see that even SF ID's are created for these history records. When I search a record with that SF ID , it says that 'the data you are trying to access could not be found...'. (Note: I use some static maps to avoid duplicate history record creation because of recursive trigger; in case if it matters).  Please let me know if anyone has come across this situation before.
  • February 14, 2016
  • Like
  • 0
 I have a basic question. I have a big VF page with many sections which render/hide based on some flags. The flags are set in constructor of controller extension and are mostly depend on the logged-in user profile, role etc. (i.e. they do not change value). Now I am trying to make my constructor thin and move these flags outside it in getter/setter methods. However, I want to know if these getters will always be called when they are referenced in 'rendered' on multiple sections etc. (i.e. the flags are referred in VF page multiple times). When I did some testing, it looks like they are called only first time but want to confirm my understanding. With the flags being set in constructor, I am assured that they will run only once when the page loads. But I want to reduce the code in constructor.
  • October 24, 2015
  • Like
  • 0
I want to know the best optimized way to access current logged in user's information and set few flags. I have a controller extension and I have set flags in constructor like this:

 User u = [SELECT ID,Name,ProfileID,Profile.Name,UserRole.Name,UserRole.ID,Team_Lead__c,Leading_Teams__c,Department,Desk__c
             FROM User 
             WHERE id=:userId];

if(u.UserRole.Name != null && u.UserRole.Name.contains('xyz')){
                isComUser = true;
      }      
            if(u.UserRole.Name != null && u.UserRole.Name.contains('pqr'))   { 
                isFPUser = true; 
}


...and the conditions go on..
There are so many conditions that constructor has become really big & unmanagable.

Is there a good way to do this? Thanks in advance
  • October 21, 2015
  • Like
  • 0