• cbro
  • NEWBIE
  • 225 Points
  • Member since 2013

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 68
    Replies

Is there any way to change the owner of a Chatter group outside of deleting and re-creating the group? We have an admin who will no longer be in our instance of Salesforce, so his login will be inactivated. We would like him to be removed as owner of all the groups he has created.

 

Thanks

Larry

How can I limit Opportunity Product Selection to a specific Record Type?

Can I do this with Apex Code, or would this be Visualforce?

For example:
  • For Record Type A, Products 1,2, and 3 should be available to select.
  • For Record Type B, Product 4 only should be available to select
  • For Record Type C, Products 1,4, and 5 should be available to select.
Thanks in advance for any help.
cbro

I saw this post (here (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AcxbIAC)), which may help, but any other help would be greatly appreciated.
  • January 06, 2015
  • Like
  • 0

What I'd like to do is have this trigger update the Asset "Inactive_Date__c" with the Contract "End_Date__c" ONLY if Contract "End_Date__c" != null.  That is, only if there is an End Date on the Contract should the Inactive Date on the Asset be updated.  The Inactive Date should never be changed if the End Date on the Contract is 'null'.

 

Can anyone help me with this?

 

 

  for(Asset a: [Select Contract__c, Contract__r.End_Date__c, Inactive_Date__c from Asset where Contract__c =: Trigger.newMap.keyset() ])
        {
            System.debug('++++ querying associated assets' );
            a.Inactive_Date__c = Trigger.newMap.get(a.Contract__c).End_Date__c; 
            System.debug('++++ updating inactive date on assets with contract inactive date = ' + a.Inactive_Date__c);
            assetsToUpdate.add(a);
        } 
      

 

 

 

Thanks,
Chris

 

  • August 27, 2013
  • Like
  • 0

I have a field that is a formula field that is a concatenation of two other fields.

 

The Custom field is on the Standard Contract Object "Contract.SourceContractID__c" and it's a formula field which concatenates of "Account.Field__c" & "Contract.Number__c" 

 

So if Account.Field__c = 12345

and Contract.Number__c = 00001

 

then, SourceContractID__c = 1234500001.

 

The problem is this:  This SourceContractID__c field is a link to another system.

 

If Account.Field__c CHANGES, then the Formula changes the Contract.SourceContractID__c field to concatentate the new value entered into the Account.Field__c plus the Contract.Number__c (which is a system generated number and cannot be changed.

 

So if Account.Field__c WAS 12345, but changes to 99999

and Contract.Number__c REMAINS 00001

then, Contract.SourceContractID__c CHANGES to 9999900001.

 

This throws off the integration to the other system, because the ID it's looking for has now changed!!!, and screws everything up.  

 

There is a business need to be able to change Account.Field__c, so I can't lock that field down.

 

QUESTION:

Is there a way via a Validation Rule for me to LOCK Contract.SourceContractID__c after it has been initially filled in (even though it is a formula field), so that it cannot be changed if Account.Field__c changes?

 

Thanks in advance for any and all help!

 

Here is the formula field on the Contract Object:

Contract.SourceContractID__c: 

 Account.Field__c & Number__c

 

 

  • August 12, 2013
  • Like
  • 0

I can't figure out why this trigger does not work sometimes.

 

It doesn't do anything at all, sometimes.  Other times it adds the wrong Record Id into the Lookup field.  Other times it works just fine.

 

It seems to freak out during data loads.  It seems to work (most of the time, but not always) during the normal UI/UX.

 

I'm trying to pull a Record Id from a formula field (Contract_Header__c).  That Record Id should fill in the Contract_Header_LOOKUP__c field.  That's it.  This should happen within the Object (Contract_Line__c) whenever it is created by another object (Asset) which fires a trigger when Asset.Status = 'Active'.

 

Existing Code:

 

trigger ContractLine on Contract_Line__c (before insert, before update)  {
    
    List <Contract_Line__c> clsToUpdate = new List <Contract_Line__c>();
    String headerName, accountName;
    Id chId;

    for(Contract_Line__c c: Trigger.new)
    {
        System.debug('++++ looping through Contract_Line__c trigger context ');
        
        if(c.Contract_Header_LOOKUP__c == null && c.Contract_Header_Name__c != null ){
            System.debug('++++ Contract_Header_LOOKUP__c not null && Contract_Header_Name__c not null  ');
            System.debug('++++ assigning account name and header name ');
            accountName = c.Account__c;
            headerName = c.Contract_Header_Name__c;
        }
    }

    for(Contract_Header__c ch : [SELECT Id FROM Contract_Header__c WHERE Name =: headerName AND Account__c =: accountName ])
    {
        System.debug('++++ query for loop to find Contract_Header__c with matching headername and account ');
        chId = ch.Id;
        System.debug('++++ assigned chId  = ' + chId);
    }

    for(Contract_Line__c cl: Trigger.new)
    {
        System.debug('++++ back in trigger context to udpate contract header');
        if(chId != null)
            cl.Contract_Header_LOOKUP__c = chId;
        System.debug('++++ udpated Contract_Header_LOOKUP__c on contractline ');    
        System.debug('++++ cl.Contract_Header_LOOKUP__c = ' + cl.Contract_Header_LOOKUP__c);
    }
    
}

 

Old Code - which worked - but threw too many exceptions (on SOQL queries when doing data loads or lots of changes - b/c there weren't enough filters in place:

trigger ContractLine on Contract_Line__c (after insert, after update){
   List <Contract_Line__c> cList = new List <Contract_Line__c>();
   List <Contract_Header__c> cHeaderList = new List <Contract_Header__c>();
   for(Contract_Line__c c: [Select Contract_Header__c, Contract_Header_LOOKUP__r.Most_Recent_Update__c from Contract_Line__c where Id IN :Trigger.newMap.keySet()])
   {
   c.Contract_Header_LOOKUP__r.Most_Recent_Update__c = System.now();
       cList.add(c);
       
cHeaderList.add(c.Contract_Header_LOOKUP__r);       }
           
   if(cHeaderList.size()>0)
   {
    try{
     update cHeaderList;
    }catch(DMLException e)
    {
     system.debug (e); 
    }
   }
}

 

Can anyone help me to make this work?

 

  • July 09, 2013
  • Like
  • 0

NOT(DAY(EndDate) =28 || DAY(EndDate) =29 || DAY(EndDate) =30 || DAY(EndDate) =31)

 

This covers all possible last day of the month days - but if someone enters June 28th, it will still allow for it to be entered.

 

How can I change this to only allow for the last day of the month to be entered as a date?

 

i.e. 

Jan 31

Feb 28 or 29

Mar 31

Apr 30

May 31

Jun 30

Jul 31

Aug 31

Sep 30

Oct 31

Nov 30

Dec 31

 

  • June 06, 2013
  • Like
  • 0

I need to deploy to production some code, and cannot because only 36% (9/25) of this trigger is covered.

 

I also need to remove this trigger (it's old and is no longer valid for the business - and was written by someone else).

 

Can someone help me with this test class for the following trigger?  Everything in RED is not being tested.

 

I am new to writing triggers and test classes - so any help is greatly appreciated for this newbie....

 

Thanks, 
Chris

 

Here is the Trigger:

 

	  trigger Lead_UpdateAccountsOwner on Lead (after update) {
 2	  
 3	  System.debug('DEBUG::DEBUG-->Lead_UpdateAccountOwner - Converted Account ID : '  + trigger.new[0].convertedAccountId );
 4	      
 5	      List<String> lstOfProfiles=new List<String>();
 6	      lstOfProfiles.add('Product Specialist Standard User');
 7	      lstOfProfiles.add('Product Specialist System Admin User');
 8	      
 9	      List<String> roleNames= new List<String>();
 10	      roleNames.add('PM SuperUser');
 11	      //calling function from validating class
 12	       Boolean resultp=ProfileValidator.validateLoginUserProfile(lstOfProfiles);
 13	       Boolean result = false;
 14	       result=  ProfileValidator.CheckLoginUserRole(UserInfo.getUSerId());
 15	       
 16	    if(result == true)
 17	    {
 18	   

//get converted account ids in set

 19	      set<id> accountIds = new Set<Id>();
 20	      set<id> contactIds = new Set<Id>();
 21	      
 22	      for(Lead ld: trigger.new)
 23	      {
 24	          accountIds.add(ld.convertedAccountId);
 

25

	          contactIds.add(ld.convertedContactId);
 26	      }
 27	      
 28	      //query all converted accounts with owenr id
 29	      Map<id,Account> map_AssociatedAccounts = new Map<id,Account> ([SELECT id, OwnerId from Account WHERE id in: accountIds and Type = 'Prospect']);
 30	      Map<id,Contact> map_AssociatedContacts = new Map<id,Contact> ([SELECT id, OwnerId from Contact WHERE id in: contactIds]);
 31	      
 32	      //change owner of associated accounts
 33	      for(Lead ld: trigger.new)
 34	        {
 35	           Account act = map_AssociatedAccounts.get(ld.convertedAccountId);
 36	           if(act!=null)
 37	            {
 38	               act.OwnerId = ld.OwnerId;
 39	            }
 40	           
 41	           Contact con = map_AssociatedContacts.get(ld.convertedContactId);
 42	           if(con!=null)
 43	            {
 44	               con.OwnerId = ld.OwnerId;
 45	            }
 46	        }
 47	      
 48	      //update accounts
 49	      update map_AssociatedAccounts.values();
 50	      update map_AssociatedContacts.values();
 51	  
 52	  
 53	    }
 54	   
 55	  
 56	  }

 

See associated Test Classes below (60% 9/15):

 

global class LeadOwnerChange implements Database.Batchable<sObject>
{
List<Group> que;
public  LeadOwnerChange ()
 {
   que = new List<Group>(); 
   que = [Select Id ,Type,Name From Group where Name = 'Product Specialist Marketing Group' and type='queue' limit 1];
 }
public String Query{get;set;}
 
 
global Database.QueryLocator start(Database.BatchableContext BC)
   {
     return Database.getQueryLocator(Query);
   }

 global void execute(Database.BatchableContext BC,List<Lead> batch)
   { 
   if(que.size()>0)
   {
     for (Lead led :batch)
      {
      System.Debug('BBBBBBBBBBB'+que);
         System.Debug('AAAAAAAAAA'+led);
        led.OwnerId= que[0].id;
      }
   update batch;
    
   }
   }
  global void finish(Database.BatchableContext BC) 
  {
    
  }
}

 

Here is a second Test Class that is trying to do something...  (25% 1/4)

 

global with sharing class ScheduleLeadOwnerChange implements Schedulable 
{   
    global void execute(SchedulableContext SC)
     {
 
         LeadOwnerChange leadUpdate = new LeadOwnerChange();
         leadUpdate.Query = 'Select l.Id From Lead l  where l.IsConverted = false and l.CreatedDate   < LAST_90_DAYS';
         
         
         Database.ExecuteBatch(leadUpdate ,200);
         
         
         }
}

 

  • May 20, 2013
  • Like
  • 0

I want to pass along the date, as well as the status to the Asset Object from the Contract Object - when I set the Contract Object's end date.

 

The code I have is passing along the status (so when I END the Contract, it sets the Asset's Status to 'Inactive'), but it is not passing along the date.

 

So the problem is, that the Assets are having a different end date from the Contract.

 

Can anyone help?

 

trigger ContractStatusUpdatesAsset on Contract(before insert,before update){

    List<Id> conIds = new List<Id>();
    List<Asset> newAssetlist =  new List<Asset>();
    
    for(Contract cnt:Trigger.new)
    {
    if(cnt.Status=='Expired')
        {
        conIds.add(cnt.Id);
        }
    }

    List<Asset> childAssets = [Select Contract__c, Status FROM Asset WHERE Contract__c IN:conIds];
    
    for(Asset a : childAssets)
    {
        a.Status='Inactive';
        newAssetlist.add(a);
    }
    
    
    if(childAssets.size() > 0)
            
    {
    //System.debug('Chris has values to insert = '+ newAssetList.size());
    try
         {
            update newAssetlist;
         }
             catch (System.Dmlexception e)  
         {
         system.debug (e); 
         }
    }    
    
    
}

 

  • May 09, 2013
  • Like
  • 0

Can anyone help me to fix this trigger?  

 

What am I missing here?

 

 

Error: Compile Error: expecting a left angle bracket, found '>' at line 3 column 32

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before insert, before update){

Set <Id> headerIds = new Id<Set>():
List <Contract_Line__c> contractLines = new List <Contract_Line__c>();
List <Contract_Line__c> updateContractUpdate = new List <Contract_Line__c>();

//go through trigger items and add related headers to a set
for(Contract_Line__c c: Trigger.new){
headerIds.add(c.Contract_Header_LOOKUP__c)
}

//go through headers and get account Ids
    List <Contract_Header__c> headers = [Select Id, Account__c FROM Contract_Header__c WHERE Id IN: headerIds];

    //match header accounts to cl accounts
List <Contract_Line__c> contractLines = [Select Id, Contract_Header_LOOKUP__c
     FROM Contract_Line__c
     WHERE Id IN: Trigger.newMap.keySet()
     AND Account__c IN: contractHeaderAccts]);

//copy the record id to contract header lookup
if(contractLines.size()>0 && headers.size()>0){     
for(Contract_Line__c cl: contractLines){
for(Contract_Header__c ch: headers){
cl.Contract_Header_LOOKUP__c = ch.Id;
updateContractUpdate.add(cl);
}
}
}

    if(updateContractUpdate.size()>0){
     update updateContractUpdate;
    }
 }

 

 

This was my original code, but I was getting too many SOQL queries (not enough filters) when uploading data, so I changed it (with lots of help) to the above:

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before insert, before update)
{

    for (Contract_Line__c cl: Trigger.new)
    {
        
        if(cl.Contract_Header_LOOKUP__c == Null)
        {
            cl.Contract_Header_LOOKUP__c = [SELECT id FROM Contract_Header__c WHERE Name =: cl.Contract_Header__c].id ;
        }
        
    }
    
}

 

  • April 25, 2013
  • Like
  • 0

Help with this trigger:

 

  • I don't want to change the Account Owner if there is ALREADY an Account Owner
  • This Lead should become an Opportunity for the person who is converting it (and it should be in their name), but it should NOT change the Account Owner at all unless the following is true: 
  1. ADD an Account Owner (to the converter of the Lead) if they are creating a NEW Account from a Lead. 
  2. ADD an Account Owner if there is no Account Owner for the existing Account.

How would I change this trigger to do so?

 

This trigger was built by someone else a long time ago - and I am not sure I understand all of the pieces.  :/

 

Any help would be appreciated...

 

Additionally - I have put in a validation rule that does not allow specific users to Change Account Owners - (which is what's causing this to stop working...) - that said - I still don't want them to change Account Owners - I just want them to be able to add an Account Owner if it is null or if they are creating a new Account.  (See my validation rule below)... would I need to change that, as well?

 

trigger Lead_UpdateAccountsOwner on Lead (after update) {

System.debug('DEBUG::------->Lead_UpdateAccountOwner - Converted Account ID : '  + trigger.new[0].convertedAccountId );
    
    //this needs to be updated every time a new Profile is added that converts Leads
    List<String> lstOfProfiles=new List<String>();
    lstOfProfiles.add('Product Specialist Standard User');
    lstOfProfiles.add('Product Specialist System Admin User');
    lstOfProfiles.add('Product Specialist User');
    lstOfProfiles.add('Product Specialist System Admin User 2');
    
    //this needs to be updated every time a new Role is added that converts Leads
    List<String> roleNames= new List<String>();
    roleNames.add('PM SuperUser');
    roleNames.add('Performance Manager');
    
    //calling function from validating class
     Boolean resultp=ProfileValidator.validateLoginUserProfile(lstOfProfiles);
     Boolean result = false;
     result=  ProfileValidator.CheckLoginUserRole(UserInfo.getUSerId());
     
  if(result == true)
  {
    //get converted account ids in set
    set<id> accountIds = new Set<Id>();
    set<id> contactIds = new Set<Id>();
    
    for(Lead ld: trigger.new)
    {
        accountIds.add(ld.convertedAccountId);
        contactIds.add(ld.convertedContactId);
    }
    
    //query all converted accounts with owenr id
    Map<id,Account> map_AssociatedAccounts = new Map<id,Account> ([SELECT id, OwnerId from Account WHERE id in: accountIds and Type = 'Prospect']);
    Map<id,Contact> map_AssociatedContacts = new Map<id,Contact> ([SELECT id, OwnerId from Contact WHERE id in: contactIds]);
    
    //change owner of associated accounts
    for(Lead ld: trigger.new)
      {
         Account act = map_AssociatedAccounts.get(ld.convertedAccountId);
         if(act!=null)
          {
             act.OwnerId = ld.OwnerId;
          }
         
         Contact con = map_AssociatedContacts.get(ld.convertedContactId);
         if(con!=null)
          {
             con.OwnerId = ld.OwnerId;
          }
      }
    
    //update accounts
    update map_AssociatedAccounts.values();
    update map_AssociatedContacts.values();


  }
 

}

 

 

 VALIDATION RULE: Account_Ownership_Change_Not_Allowed

 

NOT(ISNEW()) &&
AND(
OR( $User.ProfileId ='00e80000001KC2s',
$User.ProfileId ='00e80000001K8tw',
$User.ProfileId ='00e30000000eH6i',
$User.ProfileId ='00e30000000eH6h',
$User.ProfileId ='00e80000001KCUK'),
ISCHANGED(OwnerId))

 Error Message: You cannot change the Account Owner.

  • April 22, 2013
  • Like
  • 0

I am trying to prevent these Profiles from changing Account Owner.

 

This is what I have, but it does not seem to be working.

 

Thanks in advance for any help!

Chris

 

NOT(ISNEW()) && 
  AND( 
      OR( $User.ProfileId ='00e80000001KC2t', 
             $User.ProfileId ='00e80000001KC2s', 
             $User.ProfileId ='00e80000001K8tw',
             $User.ProfileId ='00e30000000eH6i',
             $User.ProfileId ='00e30000000eH6h',
             $User.ProfileId ='00e80000001KCUK'), 
                                                                    ISCHANGED(OwnerId))

 

  • March 20, 2013
  • Like
  • 0

I am having an issue with my trigger.  The problem is probably that the Object B (Asset) is NOT a child record, but a related object via a lookup field.

 

Can anyone help with this code?  

 

Trigger: I need to update Status on related Asset Record(s) to 'Inactive' - whenever Status on related Contract Record changes to 'Expired'

 

It is not compiling b/c of it, I guess:   Save error: No such column 'Contract' on entity 'Asset'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

trigger ContractStatusUpdatesAsset on Contract (after insert, after update) 
{


// 1
List<Asset> childAsset = [Select Contract, Status FROM Asset WHERE Asset IN: Trigger.newMap.keySet()];
        
// 2
    for(Asset child :childAsset)
    {
// 3
    //if(trigger.isInsert && child.Status == 'Active', 'Pending')
    //    {
    //        child.Status = 'Inactive';
    //    }
// 4
    //else 
    if(trigger.isUpdate && child.Status == 'Active', 'Pending' && trigger.NewMap.get(child.Contract).Status != trigger.OldMap.get(child.Contract).Status)
        {
            child.Status = 'Inactive';
        }
    }
        
// 5
    if(childRecords.size() > 0)
            
    {
    //System.debug('Chris has values to insert = '+ newConList.size());
    try
         {
        update childAsset;
         }
         catch (System.Dmlexception e)  
         {
         system.debug (e); 
         }
    }
}
}

 

 

  • March 15, 2013
  • Like
  • 0

I have a few questions, as I am very new to building triggers, dev work...

 

This is mostly to get all of what I need out on the table, and I understand this is a large amount of work...  I just don't even know where to start.  

 

Any help would be greatly appreciated!

 

 

My problems: 

  • I need to make sure there can be only one 'Active'/'Pending' Contract per Account.
  • I need to make sure I can have multiple Opportunities associated with that one Contract in 'Active'/'Pending' Status.
  • I need to make sure I cannot create a new Contract from an Opportunity (or from anywhere else) if an 'Active'/'Pending' Contract already exists for an Account.
  • If there is an 'Active'/'Pending' Contract associated with an Account for which a new Opportunity is made, I need that Contract Number to auto-fill in a field on any new Opportunity (Opportunity.Current_Contract__c)
  • If there is an 'Expired' Contract, I need the most recent 'Expired' Contract to auto-fill in a lookup field on the new Contract - that it is replacing the old 'Expired' Status Contract (Contract.Expired_Contract__c).
  • I can have multiple Contracts in 'Expired' status - but I should not be able to add 'Assets' or associate Opportunities to these 'Expired' Contracts.

 

Thanks again in advance for any help at all!

Chris

  • March 14, 2013
  • Like
  • 0

Only a few specific profiles can convert leads.

 

That being said, I want to make sure those users cannot use the 'Convert Lead' button unless a checkbox field 'Lead.Validated__c' is checked.

 

I think I have the beginning of it, but I don't know how to finish it.

 

I am unsure of the part below (as it's not working) that says: 

NOT( Validated__c ) , 
Convert Lead = TRUE 
)

Here is the full rule, that doesn't work:  any help would be greatly appreciated!

 

AND( 
OR( 
$User.ProfileId ='00e80000001KC2t', 
$User.ProfileId ='00e80000001KC2s', 
$User.ProfileId ='00e80000001K8tw' 
), 
NOT( Validated__c ) , 
Convert Lead = TRUE 
)

 

  • March 11, 2013
  • Like
  • 0

I have code that creates a new Contract_Line__c record whenever I change the status of my parent object, Asset, to 'Active'.

 

How do I make sure the Contract_Line__c is updated whenever I edit my Asset thereafter?

 

(As an aside, all of my Contract_Line__c fields are updated by formula fields related to the parent Asset - but this doesn't take care of updating the record.  I need it to actually update the record so I can have a second trigger fire (from the Contract_Line__c record)).

 

Thanks for any help!

 

Here is my current code, which only takes care of creating new Contract_Line__c records (and not creating duplicates):

 

trigger Asset on Asset (after update) {

    List <Contract_Line__c> contractLines = new List <Contract_Line__c> ();
    Map <Id, Asset> oldmap = new Map <Id, Asset>();
    Map <Id, Asset> newmap = new Map <Id, Asset>();

    //System.debug('Chris in trigger');
    if(Constants.ASSET_FIRST_RUN == False){ }else 
    for(Asset a: Trigger.new) 
    {
    //System.debug('Chris in asset loop')
    if ((Trigger.oldMap.get(a.Id).Status != Trigger.newMap.get(a.Id).Status) && Trigger.newMap.get(a.Id).Status == 'Active')
        { 
        //System.debug('Chris in status changed');
        Contract_Line__c cl = new Contract_Line__c ();
        cl.Asset__c = a.Id;
        //this needs to "update" the record so that it also "updates" the related Contract Header
        //cl.Line_No__c = 
        //need to add new number for the Line Number (cl.Line__c) on Contract Line
        //but make sure it's not the same number as one that was already existing for this Contract_Header__c
        
        //System.debug('Chris creating new contract line and adding to list');
        contractLines.add(cl);
        }
        Constants.ASSET_FIRST_RUN = False;      
    }



    if(contractLines.size()>0)
    {
    //System.debug('Chris has values to insert = '+ contractLines.size());
    try
     {
        insert contractLines;
     }
     catch (System.Dmlexception e)  
     {
        system.debug (e); 
     }
    }
}

 

  • March 06, 2013
  • Like
  • 0

So here is what I have, but the problem is that it is always displaying as 'no' - whether checkbox is true or false.

 

Can anyone help me to fix this?

 

Thanks,
Chris

 

IF(Contract_Line__r.Synced_with_RMB__c <> False, 'yes', 'no')

 

  • March 04, 2013
  • Like
  • 0

I need to add a number to the Contract_Line__c record that is created in the trigger below.

 

It cannot be the same number (cl.Line_No__c) as another Contract_Line__c record that is associated with the same Contract_Header__c record that this new one that is created is associated with.

 

It needs to start with 1 - and then go from there.

 

Example:

 

Each Contract_Line__c record created is also associated with a Contract_Header__c record - which is inherited from the Asset record.

 

If I create one Contract_Line__c record, and it has Contract_Line__c.Line_No__c = '1' - and it's associated with Contract_Header__c record 'XXX1'

 

The next Contract_Line__c record that is created (and associated with Contract_Header__c record 'XXX1') should then have a Contract_Line__c.Line_No__c = '2'

 

and so on...

 

Further:

When a Contract_Line__c record then has an End Date (Contract_Line__c.End_Date__c = Today or before), it should be removed from this sequence - and all other Contract_Line__c.Line_No__c should be updated with new numbers starting at the number 1.

 

Can I do that?

 

Does that make sense?

 

Thanks for any help.

 

trigger Asset on Asset (after update) {

    List <Contract_Line__c> contractLines = new List <Contract_Line__c> ();
    Map <Id, Asset> oldmap = new Map <Id, Asset>();
    Map <Id, Asset> newmap = new Map <Id, Asset>();

    //System.debug('Chris in trigger');
    if(Constants.ASSET_FIRST_RUN == False){ }else 
    for(Asset a: Trigger.new) 
    {
    //System.debug('Chris in asset loop')
    if ((Trigger.oldMap.get(a.Id).Status != Trigger.newMap.get(a.Id).Status) && Trigger.newMap.get(a.Id).Status == 'Active')
        { 
        //System.debug('Chris in status changed');
        Contract_Line__c cl = new Contract_Line__c ();
        cl.Asset__c = a.Id;
        cl.Line_No__c = 
        //need to add new number for the Line Number (cl.Line__c) on Contract Line
        //but make sure it's not the same number as one that was already existing for this Contract_Header__c
        
        //System.debug('Chris creating new contract line and adding to list');
        contractLines.add(cl);
        }
        Constants.ASSET_FIRST_RUN = False;      
    }

    if(contractLines.size()>0)
    {
    //System.debug('Chris has values to insert = '+ contractLines.size());
    try
     {
        insert contractLines;
     }
     catch (System.Dmlexception e)  
     {
        system.debug (e); 
     }
    }
}

 

 

 

 

 

  • March 04, 2013
  • Like
  • 0

I'm trying to make an Outbound msg. fire when the following happens on a Custom Object

 

 

I don't know why I can't think of the syntax, but it's just not saving - and I'm stuck.  

 

Any help would be greatly appreciated.

 

SRC_Contract_ID__c is a TEXT field (populated by a formula)

Most_Recent_Update__c is a DATETIME field

 

Here is the Formula I am trying to write for the workflow:

 

((SRC_Contract_ID__c <> null 

&

LastModifiedBy.Username IS NOT 'xxxxxx@xxx.com.test')

 

OR

 

(SRC_Contract_ID__c <> null

&

LastModifiedBy.Username IS NOT 'xxxxxx@xxx.com.test'

&

Most_Recent_Update__c IS now))

  • February 28, 2013
  • Like
  • 0

I am trying to populate Contract_Header_LOOKUP__c (a lookup field) with the id from Contract_Header__c (a text field)... hence, the SOQL query.

 

It compiles, but when I try to get it to work, I am getting this error.

 

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger ContractLine_ContractHeaderLookupUpdate caused an unexpected exception, contact your administrator: ContractLine_ContractHeaderLookupUpdate: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.ContractLine_ContractHeaderLookupUpdate: line 7, column 1

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before update, before insert){

    for (Contract_Line__c cl: Trigger.new)
    {
        if(cl.Contract_Header_LOOKUP__c == Null)
        {
            cl.Contract_Header_LOOKUP__c = [SELECT id FROM Contract_Line__c WHERE Name =: cl.Contract_Header__c].id ;
        }
    }
}

 

This helped me (http://boards.developerforce.com/t5/Apex-Code-Development/Can-t-get-this-trigger-to-work-any-ideas-Populate-Lookup-field/m-p/341141#M60433), but I am stuck at this point...

 

Any help is greatly appreciated!

  • February 27, 2013
  • Like
  • 0

I need to update a custom Date/Time field on thelLookupRecord any time I create or update a relatedRecord.

 

How can I build a trigger to do this?

 

 

 

  • February 26, 2013
  • Like
  • 0

I am trying to get this trigger to fire a new record on the custom object SVOC__c every time the field Account.SVOC__c is filled in OR changed with a number/text.  or goes from nothing to something. Also, this field should always be unique (it already is set to "do not allow duplicate values"  -->  but i need to know if someone is trying to create the same number/text combination.

 

It compiles fine, and it runs, but is not creating the new record.

 

In debugging the trigger is not going through past the second debug method.

 

Any help would be greatly appreciated.

 

Thanks,

Chris 

 

trigger AccountSVOC on Account (after update) 
{
    List <SVOC__c> SVOCs = new List <SVOC__c> ();
    Map <Id, Account> oldmap = new Map <Id, Account>();
    Map <Id, Account> newmap = new Map <Id, Account>();

System.debug('Chris in trigger');

    for(Account a: Trigger.new) 
    {
System.debug('Chris in account loop');
     if ((Trigger.oldMap.get(a.Id).SVOC__c != Trigger.newMap.get(a.Id).SVOC__c) && Trigger.newMap.get(a.Id).SVOC__c != null )
        { 
System.debug('Chris in status changed');
        SVOC__c SVOC = new SVOC__c ();
        SVOC.SVOC_ID__c = a.Id;

System.debug('Chris creating new SVOC and adding to list');
        SVOCs.add(SVOC);
        }
    }

    if(SVOCs.size()>0)
    {
System.debug('Chris has values to insert = '+ SVOCs.size());
     try{
        insert SVOCs;
        }catch (System.Dmlexception e)  
             {
             system.debug (e); 
             }
    }

}

  • February 22, 2013
  • Like
  • 0

What I'd like to do is have this trigger update the Asset "Inactive_Date__c" with the Contract "End_Date__c" ONLY if Contract "End_Date__c" != null.  That is, only if there is an End Date on the Contract should the Inactive Date on the Asset be updated.  The Inactive Date should never be changed if the End Date on the Contract is 'null'.

 

Can anyone help me with this?

 

 

  for(Asset a: [Select Contract__c, Contract__r.End_Date__c, Inactive_Date__c from Asset where Contract__c =: Trigger.newMap.keyset() ])
        {
            System.debug('++++ querying associated assets' );
            a.Inactive_Date__c = Trigger.newMap.get(a.Contract__c).End_Date__c; 
            System.debug('++++ updating inactive date on assets with contract inactive date = ' + a.Inactive_Date__c);
            assetsToUpdate.add(a);
        } 
      

 

 

 

Thanks,
Chris

 

  • August 27, 2013
  • Like
  • 0

I have a field that is a formula field that is a concatenation of two other fields.

 

The Custom field is on the Standard Contract Object "Contract.SourceContractID__c" and it's a formula field which concatenates of "Account.Field__c" & "Contract.Number__c" 

 

So if Account.Field__c = 12345

and Contract.Number__c = 00001

 

then, SourceContractID__c = 1234500001.

 

The problem is this:  This SourceContractID__c field is a link to another system.

 

If Account.Field__c CHANGES, then the Formula changes the Contract.SourceContractID__c field to concatentate the new value entered into the Account.Field__c plus the Contract.Number__c (which is a system generated number and cannot be changed.

 

So if Account.Field__c WAS 12345, but changes to 99999

and Contract.Number__c REMAINS 00001

then, Contract.SourceContractID__c CHANGES to 9999900001.

 

This throws off the integration to the other system, because the ID it's looking for has now changed!!!, and screws everything up.  

 

There is a business need to be able to change Account.Field__c, so I can't lock that field down.

 

QUESTION:

Is there a way via a Validation Rule for me to LOCK Contract.SourceContractID__c after it has been initially filled in (even though it is a formula field), so that it cannot be changed if Account.Field__c changes?

 

Thanks in advance for any and all help!

 

Here is the formula field on the Contract Object:

Contract.SourceContractID__c: 

 Account.Field__c & Number__c

 

 

  • August 12, 2013
  • Like
  • 0

I need to deploy to production some code, and cannot because only 36% (9/25) of this trigger is covered.

 

I also need to remove this trigger (it's old and is no longer valid for the business - and was written by someone else).

 

Can someone help me with this test class for the following trigger?  Everything in RED is not being tested.

 

I am new to writing triggers and test classes - so any help is greatly appreciated for this newbie....

 

Thanks, 
Chris

 

Here is the Trigger:

 

	  trigger Lead_UpdateAccountsOwner on Lead (after update) {
 2	  
 3	  System.debug('DEBUG::DEBUG-->Lead_UpdateAccountOwner - Converted Account ID : '  + trigger.new[0].convertedAccountId );
 4	      
 5	      List<String> lstOfProfiles=new List<String>();
 6	      lstOfProfiles.add('Product Specialist Standard User');
 7	      lstOfProfiles.add('Product Specialist System Admin User');
 8	      
 9	      List<String> roleNames= new List<String>();
 10	      roleNames.add('PM SuperUser');
 11	      //calling function from validating class
 12	       Boolean resultp=ProfileValidator.validateLoginUserProfile(lstOfProfiles);
 13	       Boolean result = false;
 14	       result=  ProfileValidator.CheckLoginUserRole(UserInfo.getUSerId());
 15	       
 16	    if(result == true)
 17	    {
 18	   

//get converted account ids in set

 19	      set<id> accountIds = new Set<Id>();
 20	      set<id> contactIds = new Set<Id>();
 21	      
 22	      for(Lead ld: trigger.new)
 23	      {
 24	          accountIds.add(ld.convertedAccountId);
 

25

	          contactIds.add(ld.convertedContactId);
 26	      }
 27	      
 28	      //query all converted accounts with owenr id
 29	      Map<id,Account> map_AssociatedAccounts = new Map<id,Account> ([SELECT id, OwnerId from Account WHERE id in: accountIds and Type = 'Prospect']);
 30	      Map<id,Contact> map_AssociatedContacts = new Map<id,Contact> ([SELECT id, OwnerId from Contact WHERE id in: contactIds]);
 31	      
 32	      //change owner of associated accounts
 33	      for(Lead ld: trigger.new)
 34	        {
 35	           Account act = map_AssociatedAccounts.get(ld.convertedAccountId);
 36	           if(act!=null)
 37	            {
 38	               act.OwnerId = ld.OwnerId;
 39	            }
 40	           
 41	           Contact con = map_AssociatedContacts.get(ld.convertedContactId);
 42	           if(con!=null)
 43	            {
 44	               con.OwnerId = ld.OwnerId;
 45	            }
 46	        }
 47	      
 48	      //update accounts
 49	      update map_AssociatedAccounts.values();
 50	      update map_AssociatedContacts.values();
 51	  
 52	  
 53	    }
 54	   
 55	  
 56	  }

 

See associated Test Classes below (60% 9/15):

 

global class LeadOwnerChange implements Database.Batchable<sObject>
{
List<Group> que;
public  LeadOwnerChange ()
 {
   que = new List<Group>(); 
   que = [Select Id ,Type,Name From Group where Name = 'Product Specialist Marketing Group' and type='queue' limit 1];
 }
public String Query{get;set;}
 
 
global Database.QueryLocator start(Database.BatchableContext BC)
   {
     return Database.getQueryLocator(Query);
   }

 global void execute(Database.BatchableContext BC,List<Lead> batch)
   { 
   if(que.size()>0)
   {
     for (Lead led :batch)
      {
      System.Debug('BBBBBBBBBBB'+que);
         System.Debug('AAAAAAAAAA'+led);
        led.OwnerId= que[0].id;
      }
   update batch;
    
   }
   }
  global void finish(Database.BatchableContext BC) 
  {
    
  }
}

 

Here is a second Test Class that is trying to do something...  (25% 1/4)

 

global with sharing class ScheduleLeadOwnerChange implements Schedulable 
{   
    global void execute(SchedulableContext SC)
     {
 
         LeadOwnerChange leadUpdate = new LeadOwnerChange();
         leadUpdate.Query = 'Select l.Id From Lead l  where l.IsConverted = false and l.CreatedDate   < LAST_90_DAYS';
         
         
         Database.ExecuteBatch(leadUpdate ,200);
         
         
         }
}

 

  • May 20, 2013
  • Like
  • 0

It seems that the new Summer'13 update enforces you to work with 18 character ID's always. For example, this happens in apex:

 

Id Id15 = string.valueOf(Id18).substring(0,15);
System.AssertEquals (Id15,Id18);

 

Pre-Summer that assertion fails, as Id15 is the 15 character Id and Id18 is the 18 character Id.
In our custom code many times we use Custom Setting and Custom Labels to avoid hardcoding recordtypes, profiles and other "constant" values. We usually worked with 15 character Ids as Salesforce (SOQL) sometimes returns 15 and other times returns 18 character Ids.

 

Now it seems the ID type always returns 18 character, if you do something like this the assertion is true:

 

Id Id15 = '012200000005byN';
System.AssertEquals (Id15,'012200000005byNAAQ');

 

As this is happening now with the Summer'13 but not happening before with Spring'13, this invalidates many coding.

We found this problem as Salesforce triggered a deep system error like this Salesforce System Error: 1619326252-34083 (1564369920) (1564369920) trying to compare a SelectOption loaded with record types with a Custom Settings String Id Stored.

 

This is a really weird annoyance. You can take a workaround working always with ID type instead of storing Ids into Strings, and always working with 18 character Ids, wether you hardcode Ids into apex and formulas (not a good approach) or you use custom setting and labels to store the ids.

 

Hope this helps... I lost all morning trying to figure out this.

I want to pass along the date, as well as the status to the Asset Object from the Contract Object - when I set the Contract Object's end date.

 

The code I have is passing along the status (so when I END the Contract, it sets the Asset's Status to 'Inactive'), but it is not passing along the date.

 

So the problem is, that the Assets are having a different end date from the Contract.

 

Can anyone help?

 

trigger ContractStatusUpdatesAsset on Contract(before insert,before update){

    List<Id> conIds = new List<Id>();
    List<Asset> newAssetlist =  new List<Asset>();
    
    for(Contract cnt:Trigger.new)
    {
    if(cnt.Status=='Expired')
        {
        conIds.add(cnt.Id);
        }
    }

    List<Asset> childAssets = [Select Contract__c, Status FROM Asset WHERE Contract__c IN:conIds];
    
    for(Asset a : childAssets)
    {
        a.Status='Inactive';
        newAssetlist.add(a);
    }
    
    
    if(childAssets.size() > 0)
            
    {
    //System.debug('Chris has values to insert = '+ newAssetList.size());
    try
         {
            update newAssetlist;
         }
             catch (System.Dmlexception e)  
         {
         system.debug (e); 
         }
    }    
    
    
}

 

  • May 09, 2013
  • Like
  • 0

Can anyone help me to fix this trigger?  

 

What am I missing here?

 

 

Error: Compile Error: expecting a left angle bracket, found '>' at line 3 column 32

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before insert, before update){

Set <Id> headerIds = new Id<Set>():
List <Contract_Line__c> contractLines = new List <Contract_Line__c>();
List <Contract_Line__c> updateContractUpdate = new List <Contract_Line__c>();

//go through trigger items and add related headers to a set
for(Contract_Line__c c: Trigger.new){
headerIds.add(c.Contract_Header_LOOKUP__c)
}

//go through headers and get account Ids
    List <Contract_Header__c> headers = [Select Id, Account__c FROM Contract_Header__c WHERE Id IN: headerIds];

    //match header accounts to cl accounts
List <Contract_Line__c> contractLines = [Select Id, Contract_Header_LOOKUP__c
     FROM Contract_Line__c
     WHERE Id IN: Trigger.newMap.keySet()
     AND Account__c IN: contractHeaderAccts]);

//copy the record id to contract header lookup
if(contractLines.size()>0 && headers.size()>0){     
for(Contract_Line__c cl: contractLines){
for(Contract_Header__c ch: headers){
cl.Contract_Header_LOOKUP__c = ch.Id;
updateContractUpdate.add(cl);
}
}
}

    if(updateContractUpdate.size()>0){
     update updateContractUpdate;
    }
 }

 

 

This was my original code, but I was getting too many SOQL queries (not enough filters) when uploading data, so I changed it (with lots of help) to the above:

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before insert, before update)
{

    for (Contract_Line__c cl: Trigger.new)
    {
        
        if(cl.Contract_Header_LOOKUP__c == Null)
        {
            cl.Contract_Header_LOOKUP__c = [SELECT id FROM Contract_Header__c WHERE Name =: cl.Contract_Header__c].id ;
        }
        
    }
    
}

 

  • April 25, 2013
  • Like
  • 0

I am trying to prevent these Profiles from changing Account Owner.

 

This is what I have, but it does not seem to be working.

 

Thanks in advance for any help!

Chris

 

NOT(ISNEW()) && 
  AND( 
      OR( $User.ProfileId ='00e80000001KC2t', 
             $User.ProfileId ='00e80000001KC2s', 
             $User.ProfileId ='00e80000001K8tw',
             $User.ProfileId ='00e30000000eH6i',
             $User.ProfileId ='00e30000000eH6h',
             $User.ProfileId ='00e80000001KCUK'), 
                                                                    ISCHANGED(OwnerId))

 

  • March 20, 2013
  • Like
  • 0

I am having an issue with my trigger.  The problem is probably that the Object B (Asset) is NOT a child record, but a related object via a lookup field.

 

Can anyone help with this code?  

 

Trigger: I need to update Status on related Asset Record(s) to 'Inactive' - whenever Status on related Contract Record changes to 'Expired'

 

It is not compiling b/c of it, I guess:   Save error: No such column 'Contract' on entity 'Asset'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

trigger ContractStatusUpdatesAsset on Contract (after insert, after update) 
{


// 1
List<Asset> childAsset = [Select Contract, Status FROM Asset WHERE Asset IN: Trigger.newMap.keySet()];
        
// 2
    for(Asset child :childAsset)
    {
// 3
    //if(trigger.isInsert && child.Status == 'Active', 'Pending')
    //    {
    //        child.Status = 'Inactive';
    //    }
// 4
    //else 
    if(trigger.isUpdate && child.Status == 'Active', 'Pending' && trigger.NewMap.get(child.Contract).Status != trigger.OldMap.get(child.Contract).Status)
        {
            child.Status = 'Inactive';
        }
    }
        
// 5
    if(childRecords.size() > 0)
            
    {
    //System.debug('Chris has values to insert = '+ newConList.size());
    try
         {
        update childAsset;
         }
         catch (System.Dmlexception e)  
         {
         system.debug (e); 
         }
    }
}
}

 

 

  • March 15, 2013
  • Like
  • 0

I have a few questions, as I am very new to building triggers, dev work...

 

This is mostly to get all of what I need out on the table, and I understand this is a large amount of work...  I just don't even know where to start.  

 

Any help would be greatly appreciated!

 

 

My problems: 

  • I need to make sure there can be only one 'Active'/'Pending' Contract per Account.
  • I need to make sure I can have multiple Opportunities associated with that one Contract in 'Active'/'Pending' Status.
  • I need to make sure I cannot create a new Contract from an Opportunity (or from anywhere else) if an 'Active'/'Pending' Contract already exists for an Account.
  • If there is an 'Active'/'Pending' Contract associated with an Account for which a new Opportunity is made, I need that Contract Number to auto-fill in a field on any new Opportunity (Opportunity.Current_Contract__c)
  • If there is an 'Expired' Contract, I need the most recent 'Expired' Contract to auto-fill in a lookup field on the new Contract - that it is replacing the old 'Expired' Status Contract (Contract.Expired_Contract__c).
  • I can have multiple Contracts in 'Expired' status - but I should not be able to add 'Assets' or associate Opportunities to these 'Expired' Contracts.

 

Thanks again in advance for any help at all!

Chris

  • March 14, 2013
  • Like
  • 0

Only a few specific profiles can convert leads.

 

That being said, I want to make sure those users cannot use the 'Convert Lead' button unless a checkbox field 'Lead.Validated__c' is checked.

 

I think I have the beginning of it, but I don't know how to finish it.

 

I am unsure of the part below (as it's not working) that says: 

NOT( Validated__c ) , 
Convert Lead = TRUE 
)

Here is the full rule, that doesn't work:  any help would be greatly appreciated!

 

AND( 
OR( 
$User.ProfileId ='00e80000001KC2t', 
$User.ProfileId ='00e80000001KC2s', 
$User.ProfileId ='00e80000001K8tw' 
), 
NOT( Validated__c ) , 
Convert Lead = TRUE 
)

 

  • March 11, 2013
  • Like
  • 0

So here is what I have, but the problem is that it is always displaying as 'no' - whether checkbox is true or false.

 

Can anyone help me to fix this?

 

Thanks,
Chris

 

IF(Contract_Line__r.Synced_with_RMB__c <> False, 'yes', 'no')

 

  • March 04, 2013
  • Like
  • 0

I'm trying to make an Outbound msg. fire when the following happens on a Custom Object

 

 

I don't know why I can't think of the syntax, but it's just not saving - and I'm stuck.  

 

Any help would be greatly appreciated.

 

SRC_Contract_ID__c is a TEXT field (populated by a formula)

Most_Recent_Update__c is a DATETIME field

 

Here is the Formula I am trying to write for the workflow:

 

((SRC_Contract_ID__c <> null 

&

LastModifiedBy.Username IS NOT 'xxxxxx@xxx.com.test')

 

OR

 

(SRC_Contract_ID__c <> null

&

LastModifiedBy.Username IS NOT 'xxxxxx@xxx.com.test'

&

Most_Recent_Update__c IS now))

  • February 28, 2013
  • Like
  • 0

I am trying to populate Contract_Header_LOOKUP__c (a lookup field) with the id from Contract_Header__c (a text field)... hence, the SOQL query.

 

It compiles, but when I try to get it to work, I am getting this error.

 

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger ContractLine_ContractHeaderLookupUpdate caused an unexpected exception, contact your administrator: ContractLine_ContractHeaderLookupUpdate: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.ContractLine_ContractHeaderLookupUpdate: line 7, column 1

 

trigger ContractLine_ContractHeaderLookupUpdate on Contract_Line__c (before update, before insert){

    for (Contract_Line__c cl: Trigger.new)
    {
        if(cl.Contract_Header_LOOKUP__c == Null)
        {
            cl.Contract_Header_LOOKUP__c = [SELECT id FROM Contract_Line__c WHERE Name =: cl.Contract_Header__c].id ;
        }
    }
}

 

This helped me (http://boards.developerforce.com/t5/Apex-Code-Development/Can-t-get-this-trigger-to-work-any-ideas-Populate-Lookup-field/m-p/341141#M60433), but I am stuck at this point...

 

Any help is greatly appreciated!

  • February 27, 2013
  • Like
  • 0

Hello,

I have the following trigger that is designed to change an Opportunity owner to a new account owenr after an account DLoader upsert. It compares the owners of Opportunity to new owenrs of accounts and users who share accounts (indicated by UserID inserted in SLS2__c upon account update).

 

The trigger works when I change account owners manually in SFDC, but does not work wehn I use that DataLoader to update ownership. It returns the following ERROR:

updateOppOwner: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.updateOppOwner: line 17, column 1.

 

Please help.

this is the trigger inserted in Account:Triggers

====

 

Line 17 : optyMap.get(acct.id).OwnerID= acct.OwnerID;

======

Full trigger:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

 

trigger updateOppOwner on Account (after insert, after update) {
  if (Trigger.isAfter) {
  Set<Id> acctIds = new Set<Id>();
    for (Account acct : Trigger.new) {
       acctIds.add(acct.Id);
       }     
Map<id,Opportunity> optyMap = new Map<Id,Opportunity>( [SELECT OwnerId  FROM Opportunity WHERE AccountId in :acctIds]);

    if ( !optyMap.isEmpty() ) {

    for (Account acct : Trigger.new) {

        for(Opportunity opty : optyMap.values() ) {      

            if(opty.OwnerId != acct.OwnerId && opty.OwnerId != acct.SLS2__c){

               optyMap.get(acct.id).OwnerID= acct.OwnerID;
                    } else {
          opty.OwnerId = opty.OwnerId ;
                   }
            }

        update optyMap.values();

        }
  }
    }
    }

  • February 15, 2013
  • Like
  • 0

Hi, I'm fairly new to Triggers and am hoping someone can give me a bit of direction.

 

I want a custom field "Record_Mode__c" on Child Object B to be updated to value "Edit" when Parent Object A's custom field "Status__c" is updated to "Open". Basically, any time the parent record's status changes, I want the child record's Record Mode field to be updated accordingly.

 

The Record Mode change will then drive workflow that will flip record types and page layouts. I prefer to use out of the box solutions, but I cannot use cross object workflows as there is no master detail relationship between Parent Object A and Child Object B.

 

Any assistance with code or alternate solutions are much appreciated! 

Hi Everyone,, 

 

I'm trying to remove a lead record type that's not used any longer...but I seem to be encountering the following error:

 

"This record type RVP cannot be deleted because the following profiles use this record type as default. External Who"  

 

Can anyone PLEASE explain to me why this is the case? I don't have a profile called "External Who"!!! Thanks so much for the help! 

 

Regards, 

 

Studzey