• Jos vd Have
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi all,

I'm struggling with the dates in JS.
Below is my code but whatever I try I end up with an error saying "Invalid time value"
the problem is in the bold code line.
Thx in advance...
Jos

{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js" )}
var Status = "{!Case.Status}";
var newRecords = [];
if (Status != "Gesloten")
{
var c = new sforce.SObject("Case");
c.RecordTypeID = "012b0000000YfFNAA0";
c.AccountId = '{!Case.AccountId}';
c.ContactId = '{!Case.ContactId}';
c.ParentId = '{!Case.Id}';
c.Complaint_Type__c = "Standaard klacht";
c.Subject = '{!Case.Subject}';
c.Status = "In behandeling";
c.Substatus__c = "Beoordelen klacht";
c.Origin = '{!Case.Origin}';
c.Contract__c = '{!Case.Contract__c}';
c.Business_Unit__c = '{!Case.Business_Unit__c}';
c.Department__c = '{!Case.Department__c}';
c.Preferred_Contact_Method__c = '{!Case.Preferred_Contact_Method__c}';
c.Initial_opened_date__c = new Date('{!Case.CreatedDate}').toISOString();
newRecords.push(c);
result = sforce.connection.create(newRecords);
alert ('Klacht case is aangemaakt.');}
else
{
alert ('Case mag niet gesloten zijn voor deze actie.');
}
Hello everyone, I have a problem that it is driving me crazy. I have radio buttons on my Visualforce page, some of the radio buttons are hidden when you first open the page, but if let's say the radio button #10 is changed to the option 'Yes', I refresh the page and show 2 more radio buttons.

My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.

On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
 
<apex:selectRadio value="{!contact.LivesInAmerica__c}" label="Do you live in America?" id="rb1">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
     <apex:actionSupport event="onchange" action="{!functionFirst}"/>
</apex:selectRadio>
<apex:selectRadio rendered="{!showRB1}" value="{!contact.Street__c}" label="Street">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
And this code on Apex Class Controller:
 
public PageReference functionFirst(){
        if(contact.LivesInAmerica__c == 'Yes'){
            showRB1= true;
        }
        else {
            showRB1= false;
        }
        return null;
    }

Thanks!

 
Hi all,

I'm struggling with the dates in JS.
Below is my code but whatever I try I end up with an error saying "Invalid time value"
the problem is in the bold code line.
Thx in advance...
Jos

{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js" )}
var Status = "{!Case.Status}";
var newRecords = [];
if (Status != "Gesloten")
{
var c = new sforce.SObject("Case");
c.RecordTypeID = "012b0000000YfFNAA0";
c.AccountId = '{!Case.AccountId}';
c.ContactId = '{!Case.ContactId}';
c.ParentId = '{!Case.Id}';
c.Complaint_Type__c = "Standaard klacht";
c.Subject = '{!Case.Subject}';
c.Status = "In behandeling";
c.Substatus__c = "Beoordelen klacht";
c.Origin = '{!Case.Origin}';
c.Contract__c = '{!Case.Contract__c}';
c.Business_Unit__c = '{!Case.Business_Unit__c}';
c.Department__c = '{!Case.Department__c}';
c.Preferred_Contact_Method__c = '{!Case.Preferred_Contact_Method__c}';
c.Initial_opened_date__c = new Date('{!Case.CreatedDate}').toISOString();
newRecords.push(c);
result = sforce.connection.create(newRecords);
alert ('Klacht case is aangemaakt.');}
else
{
alert ('Case mag niet gesloten zijn voor deze actie.');
}