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
nik9000nik9000 

scontrol clone all but 1 field

This is probably an easy question to answer, but basically I want to be able to clone an opportunity, but during the clone, erase a foreign key that is used in another system.  I figure I can just override the existing clone with an S-Cotnrol, but I do not know the syntax of setting a value of a field during the clone.  I do not want to have to use an s-control to map every field, as this object often changes fields and I do not want to have to maintain this s-control with every change.
 
Ideally i would like to use the Clone Case Action and just set the param on that url.  Something like this:
 
var redirectURL = "{!UrlFor($Action.Case.Clone,Case.Id, [ CF00N50000001T2Vj = '' ],true)}";
 
Is this possible or do i need to write an s-control to map each field individually during a clone?
Greg HGreg H
Your syntax is correct but for some reason if you pass an empty parameter in the function it simply gets trimmed from the final result.  If you did this it would work (I think):
Code:
var redirectURL = "{!UrlFor($Action.Case.Clone,Case.Id, [ CF00N50000001T2Vj = 'value' ],true)}"; 

However, I understand that you want to empty out that value.  So why not try adding that parameter on the end of the URLFOR function - essentially forcing that parameter be passed and, hopefully, nulling out that value.
Code:
var redirectURL = "{!UrlFor($Action.Case.Clone,Case.Id,true)}&CF00N50000001T2Vj=";

I hope this works for you,
-greg
nik9000nik9000

Your example needed inputs to be valid, but did the trick.  Thank you.

 

<script type="text/javascript">

var redirectURL = "{!UrlFor($Action.Opportunity.Clone,Opportunity.Id,[retURL = $Request.retURL],true)}&00N30000001NQyl=";

window.top.location.href=redirectURL;

</script>