function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sundar84sundar84 

custom button override based on opportunity record type selection

Hi Friends 

I am confusing in custom button override based on record type selection. the scenario has explained below.

 

 

  1.  Opportunity object have two record types 'Entity' and ' Employee'.
  2.  Custom object called Background_check__c  also have two same record types.
  3.  New custom button has created for the Background_check__c.
  4.  Background_check__c custom object has displayed under the opportunity related list
My question is  if i click the new custom button the background check object record will create based on opp record type selection.
For Ex:  Entity record type opportunity  will create Entity Background check record
               Employee record type opportunity will create Employee Background check record.
How to resolve this problem.  Please post your valuable suggestion. I hope it will helps to me and all.. 
Thanks
Sundar

 

 

SurekaSureka

Hi,

 

Since you have two pagelayouts for Entity and Employee Opportunity types, You can try with the below suggestion:

 

1. Create two custom buttons in the BackgroundCheck object - like the below:

 

https://cs2.salesforce.com/a0F/e?CF00NR0000000ZqY1={!Opporutunity.Name}&RecordType=012800000002NWZ&retURL=%2F{!Opporutunity.Id}

 

where "CF00NR0000000ZqY1" is the Id of the Lookup feild

Hard code the Id of the Entity record type of BackgroundCheckobject.

 

Similarly create one more custom button, with the other record type Id.

 

Include the first custom button in the Entity page layout and the other in Employee page layout.

 

Hope this helps

 

Thanks

sundar84sundar84

 

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var oppid ='{!Opportunity.Id}'
var oppname ='{!Opportunity.Name}'
var opprecordTypeid='{!Opportunity.RecordTypeId}';
var BackrecordTypeid='{! Background_check__c.RecordTypeId }';
if ( opprecordTypeid = '012T0000000D0Pb' && BackrecordTypeid = '012T0000000D0Pl') {
    window.parent.location.href = /a06/e?CF00NT00000016X0J={!Opportunity.Name}&     
    CF00NT00000016X0J_lkid={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}&RecordType=012T0000000D0Pl& 
     ent=01IT000000051Uk
}
else{
    window.parent.location.href = /a06/e?CF00NT00000016X0J=Test+Entity+Application&   
   CF00NT00000016X0J_lkid=006T0000005KAKM&retURL=%2F006T0000005KAKM&RecordType=012T0000000D0Pg&
    ent=01IT000000051Uk
}

 

Hi sureka

I would like to have one custom button in the Background check object. the record type selection will  differed based on opportunity record type. how can i achieve this.  i am using this script but not working. please can u post ur suggestion.

 

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

{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var oppid ='{!Opportunity.Id}';

var oppname ='{!Opportunity.Name}';

var opprecordTypeid='{!Opportunity.RecordTypeId}';

var BackrecordTypeid='{! Background_check__c.RecordTypeId }';

 

//Employee record type selection if the opp record type is Employee

 

if ( opprecordTypeid = '012T0000000D0Pb' && BackrecordTypeid = '012T0000000D0Pl') {

 window.parent.location.href = /a06/e?CF00NT00000016X0J={!Opportunity.Name}&         CF00NT00000016X0J_lkid={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}&RecordType=012T0000000D0Pl&      ent=01IT000000051Uk

}else{ 

   window.parent.location.href = /a06/e?CF00NT00000016X0J=Test+Entity+Application&     CF00NT00000016X0J_lkid=006T0000005KAKM&retURL=%2F006T0000005KAKM&RecordType=012T0000000D0Pg&    ent=01IT000000051Uk

}

 

Thanks

Sundar