• Julius Salvador
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi All,

How do I create a validation rule that prohibits a user who has the capability to transfer records not to transfer a lead if a field is checked?

I have a custom field named "Transferable" on the leads, and what I wish to do is to only allow users to reassign the lead to other user if the "Transferable" field is checked. Thanks in advance.
Hello Guru's,

I've created an Apex Class, a Visual Force Page, and a custom field named "Last Viewed By" earlier, the goal is to have the feature of knowing who last viewed an account record in SF. Both of the Apex Class and Visual Force page are working fine, although there's a bit issue, It messes up the "Last Modified By" Field as well. So for example: USER 1 viewed the Account named Account 1 (viewed only, no editting done), when User 2 views the same account both of the "Last Viewed By" and "Last Modified By" field are now showing USER 1 DD/MM/YYYY TIME. Any advise, or suggestions on what changes needs to be done on the codes below.

APEX CLASS
public class lastViewedAccount{
public Datetime cDT;
public String LongDate;
public String firstname;
public String lastname;
public String userid;
private final Account acct;
public lastViewedAccount(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord(); }
public String getLongDate() {
cDT = System.now(); //Format the datetime value to your locale
LongDate = cDT.format('dd/MM/yyyy HH:mm'); return LongDate;
}
public void updateField() {
//Get the user info from the current user
firstname = System.Userinfo.getFirstName();
lastname = System.Userinfo.getLastName();
userid = System.Userinfo.getUserId();
//Get the Account record to be updated
Account a = [select Last_Viewed_By__c from Account where id = :acct.id limit 1];
//Assign values to Last Viewed By field & update the record
a.Last_Viewed_By__c = (firstname + ' ' + lastname + ', ' + getLongDate());
update a;
}

}

Visual Force Page
<apex:page action="{!updateField}" extensions="lastViewedAccount" showheader="false" sidebar="false" standardcontroller="Account"> </apex:page>
Hello Guru's,

I've created an Apex Class, a Visual Force Page, and a custom field named "Last Viewed By" earlier, the goal is to have the feature of knowing who last viewed an account record in SF. Both of the Apex Class and Visual Force page are working fine, although there's a bit issue, It messes up the "Last Modified By" Field as well. So for example: USER 1 viewed the Account named Account 1 (viewed only, no editting done), when User 2 views the same account both of the "Last Viewed By" and "Last Modified By" field are now showing USER 1 DD/MM/YYYY TIME. Any advise, or suggestions on what changes needs to be done on the codes below.

APEX CLASS
public class lastViewedAccount{
public Datetime cDT;
public String LongDate;
public String firstname;
public String lastname;
public String userid;
private final Account acct;
public lastViewedAccount(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord(); }
public String getLongDate() {
cDT = System.now(); //Format the datetime value to your locale
LongDate = cDT.format('dd/MM/yyyy HH:mm'); return LongDate;
}
public void updateField() {
//Get the user info from the current user
firstname = System.Userinfo.getFirstName();
lastname = System.Userinfo.getLastName();
userid = System.Userinfo.getUserId();
//Get the Account record to be updated
Account a = [select Last_Viewed_By__c from Account where id = :acct.id limit 1];
//Assign values to Last Viewed By field &amp; update the record
a.Last_Viewed_By__c = (firstname + ' ' + lastname + ', ' + getLongDate());
update a;
}

}

Visual Force Page
<apex:page action="{!updateField}" extensions="lastViewedAccount" showheader="false" sidebar="false" standardcontroller="Account"> </apex:page>