• Klivingston
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 30
    Replies
Hi All

Description: We have many record types for our Account object. many of them showing relevent info for our staff but one shows relevent info for our customers. usually our staff need to show those info to our customer and they usually dont have access to change the record type.

We would like to have a button on the customer page to change the record type between those two record types (Customer and staff view).

I have a custom button here that allows me to change the record types to our Customer view record types. But that change is permanent and I need to be able to change that to the original layout straight away.

Is there a way to achieve this? if so can you please help me with code.

Thanks in advance.


Custom Button 


Code:

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}


var ac= new sforce.SObject("Account");
ac.Id = '{!Account.Id}';

ac.RecordTypeId = '012g00000004PVM';
var result = sforce.connection.update([ac]);
 
//ac.RecordTypeId = '01220000000TwQQ';
//var result = sforce.connection.update([ac]);

if (result[0].success=='false') {

     alert(result[0].errors.message);

} else {

     location.reload(true);

}
Hi All

I would like to create a visualforce page replacing the standard related list. This is because of the long list of records we have and we would like to see only he records from last 3 months.

Can you please help me to write the code for it.

Here is what I have now:

public class ActiveHistoryClass
{
  
    public String LastModifiedDate { get; set; }
    public String ActivityDate { get; set; }
    public String IsTask { get; set; }
    public String Subject { get; set; }
    public String Name { get; set; }
    public String id { get; set; }
    public String OutbaseActivityHistory { get; set; }

    private ApexPages.StandardSetController controller;
   
    public List<Account> getActiveHistory(){
        return [SELECT (SELECT Subject,IsTask, ActivityDate,
                 LastModifiedDate  FROM ActivityHistories)
                FROM Account];
}}





<apex:page controller="ActiveHistoryClass" tabStyle="Report" >

    <apex:pageBlock >
      <apex:pageBlockTable value="{!OutbaseActivityHistory}" var="c">
            <apex:column title="Activity History">
               <apex:outputLink value="/{!Id }" target="_blank">{!Name}</apex:outputLink>
            </apex:column>     
             '<apex:column value="{!c}" onclick="window.open('https://cs17.salesforce.com/{!id}','_blank')"/>'
           
            <apex:column value="{!Subject}"/>
            <apex:column value="{!IsTask}"/>
            <apex:column value="{!ActivityDate}"/> 
            <apex:column value="{!LastModifiedDate    }"/>    
                 
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>


At the moment it does not show anything! I think I need to map Account with the activity but I am not sure how!

Thank you.

Hi All,

I would like to add this link [View Hierarchy] to our Leads and I am not sure if that is possible in any way! Same as Account object that has a [view hierarchy] link next to its name field.  

I have created the parent/child fields in our Leads object, but it is not the same. I can create a VF page to show the hierarchy view but I am not sure how I can link that to the Leads object (or better say link to name field in Leads object).

Thanks in advance. 
Hi everyone.

Can you please help me to fix this error: I have a trigger that would send an email alert to new AssignedTo user. But it through an error if the Site Defect is a new record. in other word when the Trigger.old[0].Assigned_To__c is empty. 

here is the code:

trigger SendEmailAlertToAssignedTo on Site_Defects__c (after insert, before update) { // I have the error message here

    if(Trigger.new[0].Assigned_To__c != Trigger.old[0].Assigned_To__c ) {
       
            //Sending Mail
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage() ;
          
                //Setting user email in to address
            String userName = Trigger.new[0].Assigned_To__c;
             
            User AT = [Select Email From User where id= : userName ]; 
            String userEmail = AT.Email;
          
          
            //String email = Trigger.new[0].RegionalManager__c;
            String[] toAddresses = new String[] {userEmail} ;
          
            // Assign the addresses for the To and CC lists to the mail object
            mail.setToAddresses(toAddresses );
            mail.setToAddresses(MyEmail);
          
            //Email subject to be changed
            mail.setSubject('THIS IS A TEST. Site Defect Owner Changed');
            String body = AT.Email+'The owner of Site Defect ' + trigger.Old[0].Name +' has been changed <br> <br>'+
            'Regards <br> ';
            //Body of email
            mail.setHtmlBody(body);
          
            //Sending the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            }
}

Thank you. 
Hi everyone.

Can you please help me to fix this error: I have a trigger that would send an email alert to new Assigned To user. 

here is the code: 

trigger SendEmailAlertToAssignedTo on Site_Defects__c ( before update) {
 
    if(Trigger.new[0].Assigned_To__c != Trigger.old[0].Assigned_To__c ) {
        
            //Sending Mail
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage() ;
           
                //Setting user email in to address
            String userName = Trigger.new[0].Assigned_To__c;
              
            User AT = [Select Email From User where name = : userName ];  // I have the error message here
            String userEmail = AT.Email;
           
           
            //String email = Trigger.new[0].RegionalManager__c;
            String[] toAddresses = new String[] {userEmail} ;
           
            // Assign the addresses for the To and CC lists to the mail object
            mail.setToAddresses(toAddresses );
            mail.setToAddresses(MyEmail);
           
            //Email subject to be changed
            mail.setSubject('THIS IS A TEST. Site Defect Owner Changed');
            String body = AT.Email+'The owner of Site Defect ' + trigger.Old[0].Name +' has been changed <br> <br>'+
            'Regards <br> <br>'+
            'Phillips 66 Limited <br>'+
            'Phillips 66 Centre <br>'+
            '2 Kingmaker Court <br>'+
            'Warwick Technology Park<br> '+
            'Warwick, CV34 6DB. <br> <br> <br>'+
            'Phillips 66 Limited is a company registered in England with Company No. 529086 <br>'+
            'Registered Office: 7th Floor, 200-202 Aldersgate Street, London, EC1A 4HD.<br>';
            //Body of email
            mail.setHtmlBody(body);
           
            //Sending the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            }
}



Thank you

Hi All

 

I would like to email to a person other than Account Owner when the account owner changes. Unfortunately it is not possible unless using Apex code.

 

I would be glad if you could help me write code to do the job for me. Here is pseudo code of what I am tying to achieve:

 

Trigger SendEmailToRegionalManager on Site_Defects__C after update

       if owner of Site_Defect__C record changed then

              get the name of Regional Manager of that record

              match the name to user and get the email address

              (I am not sure which one of the following is easier)

              get the email from email template change the recipient to Regional Manger send the email 

             OR

             use Mail. Function to crate email body here and then send it

      end if

end trigger

 

 

Many thanks in advance

Hi everyone,

Can you please help me to write a test class for below code:

 

public class retrieveOpenSiteDefects    {     
      private ApexPages.StandardSetController controller;                                   
      public List<Site_Defects__c> getOutbaseSiteDefects()                
       {                          
             return [SELECT Id, Name, Date_Raised__c,Contractor__c,Defect_Type__c,Status__c         
             FROM Site_Defects__c WHERE Status__c = 'Open' order by Date_Raised__c desc limit 10];           
        }
}

 I have been trying by this:

 

@isTest
public class testRetrieveOpenIncidents{

    static testMethod void testOpenIncident(){
        Incident__c i = new Incident__c(Name='test',Current_Owner__c= 'me',  Date_Occurred__c= 2013-11-12,
                                        Description__c= 'none', Due_Date__c= 2013-11-25,
                                        Open_Actions__c= 'Investigate,',
                                        RCA_Approved__c='Y',
                                        RCA_Submission_Date__c= 2013-11-12,
                                        Status__c= 'Under Investigation',
                                        Terminal__c= 'Test'
                                        Transport_Contractor__c= 'salesforce test'
                                        )
    
    
    
    }

 

for some reason it does not like date :/

 

Thanks

 

 

Hi 

 

I am trying to use Junction Object to create a many-to-many relationship. However I am not sure if JO would solve my problem. 

 

I have two objects Transport and Cases. Within the Cases there is a multi pick list filed (Feedback For) where you can choose the Transports that the feedback is for.  I.e.... EWA, PAR. ...

 

On the Transport page I want to show the Cases that the Feedback-For is for that specific transport record.

 

I.e... A case has been created, the EWA and DHL selected from the Feedback For filed. This case record should show under EWA and DHL Transport records but not PAR or others.

 

Does JO solve this problem or I should write Apex trigger for this.

 

Thanks

Hi everyone

 

I would appreciate if you could help me with this issue and the apex code. I am relativly new to Apex. Here is the scenario:

 

I have two objects Transport and Cases. Within the Cases there is a multi pick list filed (Feedback For) where you can choose the Transports that the feedback is for.  I.e.... EWA, PAR. ...

 

On the Transport page I want to show the Cases that the Feedback For is for that specific transport record.

 

I.e... A case has been created, the EWA and DHL selected from the Feedback For filed. This case record should show under EWA and DHL Transport records but not PAR or others.

 

Thanks in advance.

 

 

Can anyone find the problem with this code please:

trigger SalesHistoryRecordTypeTrigger on Account (after insert, after update){
 //One query, fill two maps. 
Map<String,Id> accountRecordTypes = new Map<String,Id>();
 Map<String,Id> ytdRTMap = new Map<String,Id>(); 
for(RecordType rt: [Select Name, Id, sObjectType From RecordType Where sObjectType in ('Account','Sales_History_YTD__c')and isActive=true]) { 
    if(String.valueof(rt.sObjectType).equalsIgnoreCase('Account')){
       accountRecordTypes.put(rt.Name,rt.Id); } 
  else{ ytdRTMap.put(rt.name,rt.Id); } 
} 
for(Account a : Trigger.new){ 
if(a.RecordTypeId == accountRecordTypes.get('Regional_View_Lit_ppl')){
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Regional_View_Record'); } 
else 
if(a.RecordTypeId == accountRecordTypes.get('Dollar View')){ 
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Page Layout Dollar view'); } 
else if(a.RecordTypeId == accountRecordTypes.get('Dual Currency View')){
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Page Layout Dual View'); }
 }
 } 

 

I am trying to change the record type of a child object (Sales_History_YTD__c) whenever a record type of its parent object changes (Account).

 

Your help is much appreciated.

I need some help with Apex code and hope you will be able to provide me with some solutions. Here is the scenario:

 

Account Object:

We have workflow rules that check the Regional manager within the Account objects and if it is equal to certain people it will change the Record type of the Account object, which then will change the page layout of the account object. (This works fine)

 

Sales History (Custom Child Object)

Then we have workflow rules for Child Object (Sales History) that check if the Account Record Types is equal to certain value (i.e. Regional_Record_Type), if yes then it should change/update the record type within the Sales History object which should change the page layout of the Sales History.(Not working)

 

 

 

I have tried the normal workflow rules and it doesn’t seems to be working.

 

Thanks in advance.

Hopefully this is a simple problem...

 

I've installed the data loader after downloading from the website... however it doesn't create a shortcut as standard.  All files are installed here:

 

C:\Program Files (x86)\salesforce.com\Data Loader

 

How does one manually create a shortcut to this?

 

Thanks in advance,

Jon

I've got the following APEX code to display a dashboard page:

 

<apex:page >
        <apex:pageBlock >
            <apex:iframe src="/01Z200000011vtB?isdtp=nv" scrolling="true" height="1588px" width="100%"/>
        </apex:pageblock>    
</apex:page>

 Is it possible to use a case statement here to choose which ID is populated here?  I.e. I've got 8 dashboards and I was wondering if you could use the {!$User.FirstName} global variable within a case statement to choose which dashboard to display?

 

Thanks!

Hello all,

 

Is it at all possible to create a VF page to display the Dashboards Tab?  The reason I ask that some of our users want to display all of their dashboards on their home page - so I thought I'd create a VF page to be displayed as their home page and populate it with the data from their dashboard tab.

 

Any help or guidance would be greatly appreciated!

 

Thanks

 

Jon Moore

Hello guys i am reasonably new to the whole apex devlopment thing and had no idea that i had to write test classes before i was allowed to migrate classes to production. the code does work, it is just a question of getting the coverage needed o allow it to be migrated.

 

I am now trying to do this and am struggling to do it. i have been reading all the help guides and various blogs but I am struggling to get even 1% coverage.

 

The code I use quieries a custom object and returns records match a criteria. the apex page itself then displays this in a dashboard.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

public class retrieveBramhallLog 
 {
  private ApexPages.StandardSetController controller; 
  
    public String getTerminalName() 
    {
        return 'Bramhall';
        return 'Time_Flag__c';
    }

    public List<Daily_Log__c> getDailyLog()
    {
                return [SELECT Id, Name, Issue_Type__c, Time_created__c FROM Daily_Log__c
                        WHERE Terminal__r.Name = 'Bramhall' order by Time_created__c desc limit 10];
    }
 
     public List<Daily_Log__c> getOutbaseLog()
    {
                return [SELECT Id, Name, Issue_Type__c, Time_created__c FROM Daily_Log__c
                        WHERE Terminal__r.Name = 'Bramhall' AND (Time_Flag__c = 1 OR weekend_check__c = 1) order by Time_created__c desc limit 10];
    }
  }

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

the test class that i have had most success with

 

@isTest 
private class try2{
    Static testMethod void t1()
    {
    Terminal__c term = new Terminal__c(Name ='test');
    insert term;
    Daily_Log__c dayLog = new Daily_Log__c(Terminal__c = 'a0AR0000005YLTC', Issue_Type__c = 'DBS');
    insert dayLog;
    try2 myclass = new try2();
    List<Daily_Log__c> l = myclass.getDailyLog();
    system.assert(l.size()>0);
    }


    public List<Daily_Log__c> getDailyLog()
    {
                return [SELECT Id, Name, Issue_Type__c, Time_created__c FROM Daily_Log__c
                        WHERE Terminal__r.Name = 'Bramhall' order by Time_created__c desc limit 1];
    }      
 }

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

I have got a test there which i think test if a list is created. Could anyone give me help on how to test the other parts of code so that I can test it fully?

This is the only way I have even got a test to run so if there is a more efficient way of doing it.

 

Hello, I have seen a few threads from last year which where stating  that when a Visual force dashboard is refreshed by clicking on the button on the home page the visualforce component disappears.

 

I haven't been able to find a solution to this and was wondering if there is anyone has found a solution to this?

 

For some reason scheduled dashboard refresh updates the page fine, but this can only be run once a day. My organisation will need to refresh the dashboard in question several times a day.

 

 

 

 

Hi All,

I would like to add this link [View Hierarchy] to our Leads and I am not sure if that is possible in any way! Same as Account object that has a [view hierarchy] link next to its name field.  

I have created the parent/child fields in our Leads object, but it is not the same. I can create a VF page to show the hierarchy view but I am not sure how I can link that to the Leads object (or better say link to name field in Leads object).

Thanks in advance. 
Hi All

Description: We have many record types for our Account object. many of them showing relevent info for our staff but one shows relevent info for our customers. usually our staff need to show those info to our customer and they usually dont have access to change the record type.

We would like to have a button on the customer page to change the record type between those two record types (Customer and staff view).

I have a custom button here that allows me to change the record types to our Customer view record types. But that change is permanent and I need to be able to change that to the original layout straight away.

Is there a way to achieve this? if so can you please help me with code.

Thanks in advance.


Custom Button 


Code:

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}


var ac= new sforce.SObject("Account");
ac.Id = '{!Account.Id}';

ac.RecordTypeId = '012g00000004PVM';
var result = sforce.connection.update([ac]);
 
//ac.RecordTypeId = '01220000000TwQQ';
//var result = sforce.connection.update([ac]);

if (result[0].success=='false') {

     alert(result[0].errors.message);

} else {

     location.reload(true);

}
Hi All

I would like to create a visualforce page replacing the standard related list. This is because of the long list of records we have and we would like to see only he records from last 3 months.

Can you please help me to write the code for it.

Here is what I have now:

public class ActiveHistoryClass
{
  
    public String LastModifiedDate { get; set; }
    public String ActivityDate { get; set; }
    public String IsTask { get; set; }
    public String Subject { get; set; }
    public String Name { get; set; }
    public String id { get; set; }
    public String OutbaseActivityHistory { get; set; }

    private ApexPages.StandardSetController controller;
   
    public List<Account> getActiveHistory(){
        return [SELECT (SELECT Subject,IsTask, ActivityDate,
                 LastModifiedDate  FROM ActivityHistories)
                FROM Account];
}}





<apex:page controller="ActiveHistoryClass" tabStyle="Report" >

    <apex:pageBlock >
      <apex:pageBlockTable value="{!OutbaseActivityHistory}" var="c">
            <apex:column title="Activity History">
               <apex:outputLink value="/{!Id }" target="_blank">{!Name}</apex:outputLink>
            </apex:column>     
             '<apex:column value="{!c}" onclick="window.open('https://cs17.salesforce.com/{!id}','_blank')"/>'
           
            <apex:column value="{!Subject}"/>
            <apex:column value="{!IsTask}"/>
            <apex:column value="{!ActivityDate}"/> 
            <apex:column value="{!LastModifiedDate    }"/>    
                 
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>


At the moment it does not show anything! I think I need to map Account with the activity but I am not sure how!

Thank you.

Hi everyone.

Can you please help me to fix this error: I have a trigger that would send an email alert to new AssignedTo user. But it through an error if the Site Defect is a new record. in other word when the Trigger.old[0].Assigned_To__c is empty. 

here is the code:

trigger SendEmailAlertToAssignedTo on Site_Defects__c (after insert, before update) { // I have the error message here

    if(Trigger.new[0].Assigned_To__c != Trigger.old[0].Assigned_To__c ) {
       
            //Sending Mail
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage() ;
          
                //Setting user email in to address
            String userName = Trigger.new[0].Assigned_To__c;
             
            User AT = [Select Email From User where id= : userName ]; 
            String userEmail = AT.Email;
          
          
            //String email = Trigger.new[0].RegionalManager__c;
            String[] toAddresses = new String[] {userEmail} ;
          
            // Assign the addresses for the To and CC lists to the mail object
            mail.setToAddresses(toAddresses );
            mail.setToAddresses(MyEmail);
          
            //Email subject to be changed
            mail.setSubject('THIS IS A TEST. Site Defect Owner Changed');
            String body = AT.Email+'The owner of Site Defect ' + trigger.Old[0].Name +' has been changed <br> <br>'+
            'Regards <br> ';
            //Body of email
            mail.setHtmlBody(body);
          
            //Sending the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            }
}

Thank you. 
Hi everyone.

Can you please help me to fix this error: I have a trigger that would send an email alert to new Assigned To user. 

here is the code: 

trigger SendEmailAlertToAssignedTo on Site_Defects__c ( before update) {
 
    if(Trigger.new[0].Assigned_To__c != Trigger.old[0].Assigned_To__c ) {
        
            //Sending Mail
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage() ;
           
                //Setting user email in to address
            String userName = Trigger.new[0].Assigned_To__c;
              
            User AT = [Select Email From User where name = : userName ];  // I have the error message here
            String userEmail = AT.Email;
           
           
            //String email = Trigger.new[0].RegionalManager__c;
            String[] toAddresses = new String[] {userEmail} ;
           
            // Assign the addresses for the To and CC lists to the mail object
            mail.setToAddresses(toAddresses );
            mail.setToAddresses(MyEmail);
           
            //Email subject to be changed
            mail.setSubject('THIS IS A TEST. Site Defect Owner Changed');
            String body = AT.Email+'The owner of Site Defect ' + trigger.Old[0].Name +' has been changed <br> <br>'+
            'Regards <br> <br>'+
            'Phillips 66 Limited <br>'+
            'Phillips 66 Centre <br>'+
            '2 Kingmaker Court <br>'+
            'Warwick Technology Park<br> '+
            'Warwick, CV34 6DB. <br> <br> <br>'+
            'Phillips 66 Limited is a company registered in England with Company No. 529086 <br>'+
            'Registered Office: 7th Floor, 200-202 Aldersgate Street, London, EC1A 4HD.<br>';
            //Body of email
            mail.setHtmlBody(body);
           
            //Sending the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            }
}



Thank you

Hi All

 

I would like to email to a person other than Account Owner when the account owner changes. Unfortunately it is not possible unless using Apex code.

 

I would be glad if you could help me write code to do the job for me. Here is pseudo code of what I am tying to achieve:

 

Trigger SendEmailToRegionalManager on Site_Defects__C after update

       if owner of Site_Defect__C record changed then

              get the name of Regional Manager of that record

              match the name to user and get the email address

              (I am not sure which one of the following is easier)

              get the email from email template change the recipient to Regional Manger send the email 

             OR

             use Mail. Function to crate email body here and then send it

      end if

end trigger

 

 

Many thanks in advance

Hi everyone,

Can you please help me to write a test class for below code:

 

public class retrieveOpenSiteDefects    {     
      private ApexPages.StandardSetController controller;                                   
      public List<Site_Defects__c> getOutbaseSiteDefects()                
       {                          
             return [SELECT Id, Name, Date_Raised__c,Contractor__c,Defect_Type__c,Status__c         
             FROM Site_Defects__c WHERE Status__c = 'Open' order by Date_Raised__c desc limit 10];           
        }
}

 I have been trying by this:

 

@isTest
public class testRetrieveOpenIncidents{

    static testMethod void testOpenIncident(){
        Incident__c i = new Incident__c(Name='test',Current_Owner__c= 'me',  Date_Occurred__c= 2013-11-12,
                                        Description__c= 'none', Due_Date__c= 2013-11-25,
                                        Open_Actions__c= 'Investigate,',
                                        RCA_Approved__c='Y',
                                        RCA_Submission_Date__c= 2013-11-12,
                                        Status__c= 'Under Investigation',
                                        Terminal__c= 'Test'
                                        Transport_Contractor__c= 'salesforce test'
                                        )
    
    
    
    }

 

for some reason it does not like date :/

 

Thanks

 

 

Hi everyone

 

I would appreciate if you could help me with this issue and the apex code. I am relativly new to Apex. Here is the scenario:

 

I have two objects Transport and Cases. Within the Cases there is a multi pick list filed (Feedback For) where you can choose the Transports that the feedback is for.  I.e.... EWA, PAR. ...

 

On the Transport page I want to show the Cases that the Feedback For is for that specific transport record.

 

I.e... A case has been created, the EWA and DHL selected from the Feedback For filed. This case record should show under EWA and DHL Transport records but not PAR or others.

 

Thanks in advance.

 

 

Can anyone find the problem with this code please:

trigger SalesHistoryRecordTypeTrigger on Account (after insert, after update){
 //One query, fill two maps. 
Map<String,Id> accountRecordTypes = new Map<String,Id>();
 Map<String,Id> ytdRTMap = new Map<String,Id>(); 
for(RecordType rt: [Select Name, Id, sObjectType From RecordType Where sObjectType in ('Account','Sales_History_YTD__c')and isActive=true]) { 
    if(String.valueof(rt.sObjectType).equalsIgnoreCase('Account')){
       accountRecordTypes.put(rt.Name,rt.Id); } 
  else{ ytdRTMap.put(rt.name,rt.Id); } 
} 
for(Account a : Trigger.new){ 
if(a.RecordTypeId == accountRecordTypes.get('Regional_View_Lit_ppl')){
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Regional_View_Record'); } 
else 
if(a.RecordTypeId == accountRecordTypes.get('Dollar View')){ 
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Page Layout Dollar view'); } 
else if(a.RecordTypeId == accountRecordTypes.get('Dual Currency View')){
    Sales_History_YTD__c.RecordTypeId = ytdRTMap.get('Page Layout Dual View'); }
 }
 } 

 

I am trying to change the record type of a child object (Sales_History_YTD__c) whenever a record type of its parent object changes (Account).

 

Your help is much appreciated.

I need some help with Apex code and hope you will be able to provide me with some solutions. Here is the scenario:

 

Account Object:

We have workflow rules that check the Regional manager within the Account objects and if it is equal to certain people it will change the Record type of the Account object, which then will change the page layout of the account object. (This works fine)

 

Sales History (Custom Child Object)

Then we have workflow rules for Child Object (Sales History) that check if the Account Record Types is equal to certain value (i.e. Regional_Record_Type), if yes then it should change/update the record type within the Sales History object which should change the page layout of the Sales History.(Not working)

 

 

 

I have tried the normal workflow rules and it doesn’t seems to be working.

 

Thanks in advance.