+ Start a Discussion
Nancy JacobsNancy Jacobs 

Have a custom button forcing users to select record type when cloning cases. Can we have a picklist value be selected (standard field = type) specifically when this clone button is used?

Thank you to Deepak K Anand for showing me my first intro to code on the Success Community.  I have a new requirement and thought it would be best to bring it over to this forum.  (my first ever post here... feeling kind of cool at the moment).  Below code is for a custom clone button on cases which forces the user to select a record type.  On the new record that is created from the clone button, can a specific picklist value be selected? (standard picklist field istype)


if("{!Case.RecordTypeId}" == "012a0000001Vtj7"){
    location.replace(
        "/setup/ui/recordtypeselect.jsp?" +
        "ent=Case&" +
        "retURL={!Case.Id}&" +
        "save_new_url=/{!Case.Id}/e?clone=1"
    );
}
else{
    location.replace(
        "/{!Case.Id}/e?clone=1"
    );
}
sfdc_ninjasfdc_ninja
You need to use the Id for the type field which is cas5.

if("{!Case.RecordTypeId}" == "012a0000001Vtj7"){
    location.replace(
        "/setup/ui/recordtypeselect.jsp?" +
        "ent=Case&" +
        "retURL={!Case.Id}&" +
        "save_new_url=/{!Case.Id}/e?clone=1&cas5=YOURVALUE"
    );
}
else{
    location.replace(
        "/{!Case.Id}/e?clone=1&cas5=YOURVALUE"
    );
}