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
mdelgadomdelgado 

Custom Button redirect URL

Hello,

 

I'm trying to implement a custom button that redirects to a url based on opportunity field value

 

I've tried the following without success:

 

if(Opportunity.Service_Required__c = "Edu Marketing","/{!$ObjectType.Project__c}/e?retURL=%2Fa06%2Fo&RecordType=012M00000008ZW3&ent=01IC0000000j3Bl","/{!$ObjectType.Project__c}/e"))

 

Can someone tell me what I am doing wrong and what options do I have?

 

I also tried to create a small javascript without success.

 

thanks,

 

Mirko

Best Answer chosen by Admin (Salesforce Developers) 
mdelgadomdelgado

UPDATE

 

I found out why my IF condition was not working.  Now my problem is with my parameters.  In my implementation, when a new project a project record type must be selected to select the correct project layout.  I'd like to skip the project record type selection (since I know the service from the opportuniy).

 

I'm not sure if this is possible.

 

thanks,

 

Mirko

All Answers

sfdcfoxsfdcfox

If you're using a custom button, use the type "URL", use this:

 

{!IF(ISPICKVAL(Opportunity.Service_Required__c,"Edu Marketing"),
URLFOR($Action.Project__c.New,Opportunity.Id,[retURL=$Action.Opportunity.View,RecordType=012M00000008ZW3,ent=01IC000000j3Bl],true),
URLFOR($Action.Project__c.New,null,null,true)}

I'm making a few educated guesses based on your post, but this should get you most of the way there.

mdelgadomdelgado

Thanks for your reply sfdcfox!

 

 

My IF condition does not seem to be working.  Let me explain more of what I am trying to do.

 

1) I've added a custom button to the my opportunity view.

 

Question:  Should I be able to get the Opportunity.Service_Required__c value from the Opportunity view?

 

The Project I am trying to create has different record types.  Based on the Service_Required__c value I want to pass the record type as a parameter in the URL.

 

thanks for your help,

 

Mirko

mdelgadomdelgado

UPDATE

 

I found out why my IF condition was not working.  Now my problem is with my parameters.  In my implementation, when a new project a project record type must be selected to select the correct project layout.  I'd like to skip the project record type selection (since I know the service from the opportuniy).

 

I'm not sure if this is possible.

 

thanks,

 

Mirko

This was selected as the best answer