3

In URL hacking, how do you insert a blank string value for a date? We have a button that we're implementing that is like the clone button, with a couple of changes. It breaks when I try to clear out the date field. By breaks, I mean it looks like the record tries to save, and then fails because there are pagelayout security issues

I tried the following values for opp9:

%00 (null)

%20 (space)

+ (space)

/{!Opportunity.Id}/e?clone=1&00N30000008Qqoc=This+Opportunity+was+Cloned&opp7=0.00&opp9=&retURL=%2F{!Opportunity.Id}}

Any ideas?

Ref: http://www.w3schools.com/charsets/ref_html_ascii.asp

  • Do you mean that you're trying to save an Opportunity record with a blank Close Date? What kind of pagelayout security issues are you getting? – Jeremy Nottingham Sep 3 '14 at 17:20
  • No, I'm not trying to save it at all. I'm trying to clear out the close date when i clone the opportunity, and have it open in edit mode, so the user has to fill in a new one. The page layout security issues I'm getting are Error: Invalid data and I'm being told that I must enter in a value. It looks almost like the record tried to save. – PartOfTheOhana Sep 3 '14 at 17:26
1

Have you tried actually leaving it blank? I tried this in my dev org and it worked (it brought up the page with the CloseDate cleared out).

/{!Opportunity.Id}/e?clone=1&opp7=0.00&opp9=&retURL=%2F{!Opportunity.Id}

Notice I use opp9= and leave it completely blank and move on to the next parameter.

| improve this answer | |
  • did you get the error message at the top of the page? "Error: Invalid Data. Review all error messages below to correct your data." I still get that. – PartOfTheOhana Sep 3 '14 at 18:47
  • That is because close date is a required field – Chris Duncombe Sep 3 '14 at 18:52
  • so, it's what @caspNZ is saying? – PartOfTheOhana Sep 3 '14 at 19:03
1

The sObject.clone() method that gets called when you invoke that URL attempts to perform a clone on the original sObject. It then saves that object and renders the page for you.

Unfortunately, this means you are probably going to have to roll your own clone page if you want to clear out the date from the Opportunity.

A good starting point would be this blog, where the Author clones all the fields via objectType.getDescribe().fields.getMap().keySet(). From there you could remove the date field from the list of fields to copy. You'd then present the page to the user with the empty date field and allow the user to save from here (presenting the appropriate error messages for null date of course).

| improve this answer | |
0

I'm not 100% on this, but I believe using just plain null will work. Like so:

/{!Opportunity.Id}/e?clone=1&00N30000008Qqoc=This+Opportunity+was+Cloned&opp7=0.00&opp9=null&retURL=%2F{!Opportunity.Id}}

| improve this answer | |
  • That doesn't work for date fields. you actually get the string null in the date field. – PartOfTheOhana Sep 3 '14 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.