• RyanYoung429
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Salesforce Operations Manager
  • Haymarket


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies
Hello!

I have some code for a VF page and the RetURL is home:

, [retURL='/home/home.jsp'],

How do i have it return to the record of the custom object that start the process?

Thanks so much,

Ryan
Hello! In regard to "Create a Java Button that calls a flow that clones a record and sets values based on the old Opportunity".

Is there any straightforward documentation on this with some screenshots? I learn fast but can't even get off the ground with a little help from support.
Hello!

I found the script below to create a Clone button on Opportunity Product but I am curious if anyone knows how to set values to specific fields like this from a regular Custom Button: "00N36000006vcDW={!IF(MONTH(Opportunity.CloseDate) + 1 == 13, DATE(YEAR( Opportunity.Start_Date__c ) + 1, 01, 01), DATE(YEAR(Opportunity.Start_Date__c ), MONTH(Opportunity.Start_Date__c ) + 1, 01))}& "

Typically it is prety straight forward but just not clear on the syntax to use for setting a few fields.


This script does the job after getting errors with the URL hack but I'm not clear on editing the script to set new field values:

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 
var metadata = sforce.connection.describeSObject('OpportunityLineItem'); 
var dontdo = ['TotalPrice']; //Add fields to blank here. Total price or Unit price is needed at minimum 
var fields = []; 
for (var i = 0; i < metadata.fields.length; i++) { 
if (metadata.fields[i].createable == "true" && dontdo.indexOf(metadata.fields[i].name) == -1){ 
fields.push(metadata.fields[i].name) 


fieldlist = fields.join([separator = ',']) 
var cloner = sforce.connection.query("SELECT " + fieldlist + " from OpportunityLineItem where id ='{!OpportunityLineItem.Id}' limit 1"); 

records = cloner.getArray("records"); 

delete records[0].Id; 
//records[0].Product_Stage__c = 'Closed Won'; // Manually override any fields down here 

result = sforce.connection.create(records); 
var editparams = ''; 
//var editparams = "&00N34000004DVHD=Closed%20Won&00X64000002DBDS=&00N24000006XBDp=&ServiceDate=&VT00S53000003CFSA=&DW00D52000002FXGs="; // Any url hacking style parameters you want added to the edit window when we open the cloned object. Can be used to blank a field that was required forcing the agent to override the default. 
window.location = '/' + result[0]['id'] + "/e?&retURL=" + result[0]['id'] + editparams;
Hello!

I have just been told that there are no settings available for Opportunity products so we are in a jam. Our reps enter the Total Price and the Quantity. We are more interested in creating a floor and then a formula field to ascertain the unit proce ourselves. Seems pretty straight forward but I found out we have to enter the unit price only.

Does anyone know of any trigger or something that will allow us to either make the SalesPrice the TotalPrice, OR, to somehow reverse the functionality of these two fields?
Hello!
I have A custom button that will allow the creation of a "child" opportunity. I have all my valuse set/cleared except I would like to Set the Start Date field to the first date of the next month and the End Date to the last day of the next month.

Does anyone have the syntax I can use after the field id to do that?
Hello!

I have some code for a VF page and the RetURL is home:

, [retURL='/home/home.jsp'],

How do i have it return to the record of the custom object that start the process?

Thanks so much,

Ryan
Hello!

I found the script below to create a Clone button on Opportunity Product but I am curious if anyone knows how to set values to specific fields like this from a regular Custom Button: "00N36000006vcDW={!IF(MONTH(Opportunity.CloseDate) + 1 == 13, DATE(YEAR( Opportunity.Start_Date__c ) + 1, 01, 01), DATE(YEAR(Opportunity.Start_Date__c ), MONTH(Opportunity.Start_Date__c ) + 1, 01))}& "

Typically it is prety straight forward but just not clear on the syntax to use for setting a few fields.


This script does the job after getting errors with the URL hack but I'm not clear on editing the script to set new field values:

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 
var metadata = sforce.connection.describeSObject('OpportunityLineItem'); 
var dontdo = ['TotalPrice']; //Add fields to blank here. Total price or Unit price is needed at minimum 
var fields = []; 
for (var i = 0; i < metadata.fields.length; i++) { 
if (metadata.fields[i].createable == "true" && dontdo.indexOf(metadata.fields[i].name) == -1){ 
fields.push(metadata.fields[i].name) 


fieldlist = fields.join([separator = ',']) 
var cloner = sforce.connection.query("SELECT " + fieldlist + " from OpportunityLineItem where id ='{!OpportunityLineItem.Id}' limit 1"); 

records = cloner.getArray("records"); 

delete records[0].Id; 
//records[0].Product_Stage__c = 'Closed Won'; // Manually override any fields down here 

result = sforce.connection.create(records); 
var editparams = ''; 
//var editparams = "&00N34000004DVHD=Closed%20Won&00X64000002DBDS=&00N24000006XBDp=&ServiceDate=&VT00S53000003CFSA=&DW00D52000002FXGs="; // Any url hacking style parameters you want added to the edit window when we open the cloned object. Can be used to blank a field that was required forcing the agent to override the default. 
window.location = '/' + result[0]['id'] + "/e?&retURL=" + result[0]['id'] + editparams;
Hello!

I have just been told that there are no settings available for Opportunity products so we are in a jam. Our reps enter the Total Price and the Quantity. We are more interested in creating a floor and then a formula field to ascertain the unit proce ourselves. Seems pretty straight forward but I found out we have to enter the unit price only.

Does anyone know of any trigger or something that will allow us to either make the SalesPrice the TotalPrice, OR, to somehow reverse the functionality of these two fields?
Hello!
I have A custom button that will allow the creation of a "child" opportunity. I have all my valuse set/cleared except I would like to Set the Start Date field to the first date of the next month and the End Date to the last day of the next month.

Does anyone have the syntax I can use after the field id to do that?

I need to refer a custom settting field in the Javascript button.

How do we refer custo setting values in Java script button code