URL Button for Salesforce1

I have a URL button ‘New Opportunity’ which creates the new opportunity and takes the user to the edit page passing through some values through the button which is on Opp Related List in a custom object.

The problem is, now I need to adapt the majority of my custom buttons to Salesforce1 and this app doesn’t accept custom buttons so I need to create a Publisher Action in order to replicate the same action.

I’ve created a Publisher Action redirecting to a Visualforce. Inside this visualforce I’ve tried passing the values through the sforce.one.navigateToURL(); function using the standard controller values to redirect, but this doesn’t seem to work. Do you know of a workaround for this?

URL Button Code:
/006/e?&retURL=%2Fa0BS0000002pJhs&opp4={!Estudio_economico__c.Empresa__c}&opp3=No informar&RecordType=01220000000Iw8t&CF00N20000002GXnJ_lkid={!Estudio_economico__c.Id}&CF00N20000002GXnJ={!Estudio_economico__c.Name}


You should be able to use the “Create Record” publisher action to define all the fields you want. You won’t need to to use sforce.one.navigateToURL() to do this (and it wouldn’t work as it doesn’t allow you to specify a full url).

Note, you also shouldn’t need to use a custom Visualforce page as you can define all the fields you need on the publisher action layout.

Once you have created this action, you can add “predefined field values” ( in the picture below, this action shows creating an Opportunity from an Account ).
enter image description here
At the bottom of the image, there is a button to add predefined field values – these can be calculations and they cover most editable fields.

EDIT It turns out you can specify the desired record type. Once I added record types to my object, I was able to set the record type in the Action definition itself.

Source : Link , Question Author : Camila Heitz , Answer Author : Caspar Harmer

Leave a Comment