• AM2014
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
I have created my first custom record type under leads (and the same new record type under accounts and contacts). While our sales people can see that new type when creating a new lead, that lead is then invisible to them. How do I make it so they can see the new record? I created a new view in leads to show the new record type - only those of us with admin privileges can see anything in that view. In every profile, it shows the new record type under "record type settings", but the problem continues. What am I missing? 
Hello Everyone,

I am trying to write the code using context variable,
I wirote the trigger code it works fine,but i need to write the logic in Apex class and call that method in trigger

Here is my trigger code.

trigger Rephistorytracking on contact (after update) {
List<Schema.FieldSetMember> trackedFields =     SObjectType.contact.FieldSets.HistoryTracking.getFields();
if (trackedFields.isEmpty()) return;

 List<RepHistory__c> fieldChanges = new List<RepHistory__c>();

 List<string> apiNameList = new List<string>();        

if(Trigger.isUpdate){
for (contact aNew : trigger.new) {

contact aOld = trigger.oldmap.get(aNew.Id);

for (Schema.FieldSetMember fsm : trackedFields) {

 String fieldName  = fsm.getFieldPath();
String fieldLabel = fsm.getLabel();

if (aNew.get(fieldName) != aOld.get(fieldName)) {

String oldValue = String.valueOf(aOld.get(fieldName));
String newValue = String.valueOf(aNew.get(fieldName));
if (oldValue != null && oldValue.length()>255) oldValue = oldValue.substring(0,255);
 if (newValue != null && newValue.length()>255) newValue = newValue.substring(0,255); 

RepHistory__c aht = new RepHistory__c();
aht.name         = fieldLabel;
aht.apiName__c   = fieldName;
aht.ChangedBy__c = UserInfo.getUserName();
aht.OldValue__c  = oldValue;
aht.NewValue__c  = newValue;
aht.Contact__c=aOld.Id;

 apiNameList.add(aht.apiName__c);
 fieldChanges.add(aht);
}        
}
}
}
if (!fieldChanges.isEmpty()) {
 insert fieldChanges;
 }
 }

could any help me out how to write the whole logic in Apex Class

Thnaks for the help.

Regards,
Jyo
I have A_info,B_info,C_info fields in user object. And i have a_luk,b_luk,c_luk fields in Custom object.

I want auto papulate the custom object fields with user object fileds.can any one help me


Thanks
Hi All,
   I have a requirement that when i calculate Net Amount=total=vat that after calculation this i have to fetch that formula field in my parent object so how can i fetch that field using Roll up Summary.
Thanks,
Sam
who to copy child field data to parent field using triggeri have two object  child(class) and parent(student) 
 
student         class
----------------------------
name           name
address        student(lookup)
rollno          rollno
------------------------------
in above to obj if student name and class name will match  then it copy rollno from class and put into student 
please tell me how to get this 
thanks,
devendra
trigger to copy child field data to parent field data 
like i have copy data from  student(child) to class (parent) but by matching the name of both child and parent 
if the name of the both child and parent are match then only save the data like if the name of both child and parent are match then when we save rollno on student it compare name if match then it automticlly stored on class
 thanks 
I have created my first custom record type under leads (and the same new record type under accounts and contacts). While our sales people can see that new type when creating a new lead, that lead is then invisible to them. How do I make it so they can see the new record? I created a new view in leads to show the new record type - only those of us with admin privileges can see anything in that view. In every profile, it shows the new record type under "record type settings", but the problem continues. What am I missing?