1

I have a custom button on Object A where it creates record for Object B (No relationship btn objects). The button works fine except it doesn't sets the record type, what iam doing wrong.

/a02/e?retURL=%2F{!A__c.Id}& aid = {!A__c.Id} & RecordType=01240000000M828& 00N40000002Hvox="Active"& 00N40000003BOiQ={!A__c.Name}& 00N40000002HvWZ="CRB"

4
  • Try the below code /a02/e?retURL=%2F{!A__c.Id}& aid = {!A__c.Id} & RecordTypeId='01240000000M828'& 00N40000002Hvox="Active"& 00N40000003BOiQ={!A__c.Name}& 00N40000002HvWZ="CRB"
    – Suresh
    Mar 5, 2015 at 20:46
  • I even tried that but doesn't works
    – Admin_BA
    Mar 5, 2015 at 20:50
  • You might want to consider creating a publisher action and using that instead.
    – crmprogdev
    Mar 5, 2015 at 20:52
  • @crmprogdev how do we use Publisher action?
    – Admin_BA
    Mar 5, 2015 at 20:56

2 Answers 2

2

For custom button's I would recommend using the following formatting in order to better sort and understand what is being passed. This is an example for a new case:

/500/e?
retURL={!Case.Id}
&RecordType=012600000005Iko
&ent=Case
&cas4={!Case.Account}
&cas4_lkid={!Case.AccountId}

The other thing to make sure is that you do not have any spaces in your URL code.

As a follow-up to the comment below I created this JS button and it seems to work (just POC):

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
var Status = '{!Case.Status}'; 
if(Status == "New") {window.location = "/500/e?retURL={!Case.Id}&RecordType=012C0000000I8IL&ent=Case"}
else if(Status == "Closed") {window.location = "/500/e?retURL={!Case.Id}&RecordType=012C0000000I8IL&ent=Case"}

I would check to make sure you need those %2f forward slashes in the URL.

8
  • Thank you It worked. Is it possible to update a field based on the status of a record? I need to pass the above values only if status is "New" for a record in Object A if status is Working then i need to pass different values, is it possible? i guess this can be done through java script but can you throw some light?
    – Admin_BA
    Mar 5, 2015 at 22:49
  • My recommendation for that is to use a hidden formula field that does the logic evaluation and creates the URL based on that logic. Let me know if that makes sense and if not I can put together an example.
    – Eric Clay
    Mar 5, 2015 at 23:18
  • @ eric clay how would we pass the formula into url , shouldn't the java script button would be easy if we use IF statements?
    – Admin_BA
    Mar 5, 2015 at 23:27
  • Getting error "invalid regular expression flag e" If({!ELA__c.Status__c} = "Active") {window.location = /a02/e? retURL=%2F{!ELA__c.Id} &RecordType=01240000000M83B &00N40000002Hvox="ELA" &00N40000003BOiQ={!ELA__c.Name} &00N40000002HvWZ="IRB" } Else if({!ELA__c.Status__c} = "Inactive") {window.location = /a02/e? retURL=%2F{!ELA__c.Id} &RecordType=01240000000M83B &00N40000002Hvox="BLA" &00N40000003BOiQ={!ELA__c.Name} &00N40000002HvWZ="CRB" }
    – Admin_BA
    Mar 5, 2015 at 23:59
  • I am assuming the button "Content type" is "URL".
    – Eric Clay
    Mar 6, 2015 at 0:20
1

The best place to learn about Global Publisher Actions, which will do what you desire, is by referring to the "Introducing Publisher Actions" Section of Chapter 8 in the Force.com Platform Fundamentals Workbook.

1
  • But what's wrong with my code?
    – Admin_BA
    Mar 5, 2015 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .