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
JackieJackie 

Help-copying autonumber into cloned record

I am trying to accomplish the following for a client:
1.On the original opportunity there is an autonumber field for Opty ID. (the number would look like IGS-#####)
2. When the opportunity is cloned we want to copy that automated number into a field called Original Oppurtonity ID. So far we have gotten as far as getting the hex equivilant copied but cannot seem to find a way to get the actual number.
 
My client needs the original ID for reporting purposes otherwise we would just go with copying the name of the original id.
 
Any thoughts or suggestions would greatly be appreciated.
 
KaushikKaushik
    Hi Jackie,
This can be done by appending the URL for cloning.
I assume that you have created 2 fields on the Opportunity page 1)Opp ID which is a auto number 2)Orig Opp ID.
1)The first step is to figure out the Field ID of the Orig Opp ID field.The easiest way to get this is by clicking the Orig Opp field in the Opportunity Fields Tab.You can see the Field ID in the URL .If it looks like
https://na3.salesforce.com/00N50000001TI8K
The ID is 00N50000001TI8K

2)Create a new button(though over-riding the existing Clone would be better).
Figure out the URL of cloning by clicking on Clone. Example you might get something like
https://na3.salesforce.com/006500000098sl9/e?clone=1&retURL=%2F006500000098sl9

Start this as the base to create the URL behind the new clone button
Insert merge fields instead of the Opp Ids
https://na3.salesforce.com/{!Opportunity.Id}/e?clone=1&retURL=%2F{!Opportunity.Id}

Then append the merge field of the Field ID
https://na3.salesforce.com/{!Opportunity.Id}/e?clone=1&00N50000001TI8K={!Opportunity.Opp_Id__c}&retURL=%2F{!Opportunity.Id}
{!Opportunity.Opp_Id__c} is the merge field of the Opp Id(auto Number)
00N50000001TI8K is the field ID of the Orig Opp ID.

(The URL can also be changed by using the URLFOR  function)
Hope this works out for you,
Kaushik



JackieJackie

Hi Kaushik,

Thanks so much for your response. I am going to try this and hopefully it will work. Is this new button in addition to the clone button? I am thinking that the user would use the button when they need the original opp.id?

Sorry to be replying with more questions. I have been thrown into SF without a lot of prep time so forgive me if my questions sound basic. This will be my first attempt at something like this,

Thanks again,

Jackie

 

JackieJackie

Kaushik,

I have one more question. When you say merged fields:

merge field of the Field ID and

Opportunity.Opp_Id_c is the merged field of the opp id (autonumber)

what has been merged. I see what you are saying to do and I am trying to get this because it would be awesome if I could show my boss that its possible, but again, I am very new at this stuff,

I really appreciat your help,

Best regards,

Jackie

 

KaushikKaushik
        Hi Jackie,
You could still have the standard clone button co-existing with the custom clone button.If not required you could remove the standard clone button from the page layout.


Regarding the merge field..a merge field is like a variable name.For example, if you want to use the Opp Id for displaying or calculation,you have no idea of its value as it is different for every opportunity.When you use its merge field ie Opportunity.Opp_Id_c,you basically tell SFDC to substitute it with the corressponding Opp Id of that particular Opportunity which is in use.

For Field ID, it is not the merge field.It is a real ID.Every field in SFDC has an internal ID.

Hope things work out for you

Kaushik
JackieJackie
Thanks for all your help Kaushik. I decided to take a break over the holiday weekend but have been working on this tonight. I think I am close but I can't get the auto-number to populate the field on the opporutnity.
 
My boss is going to give it a shot and see what he comes up with.
 
 
Again, I really appreciate your help,
 
Jackie S.


.