You need to sign in to do that
Don't have an account?
IX Salesforce Admin
Extract value from date field
Hello everyone,
I am having issues getting value of the date field from the Opportunity object. I need to get Start date and End date, store them in a variable to send them as a part of an XMLH request. I have tried few things:
var startDate = [SELECT Start_Date__c FROM Opportunity where Id = 'XYZ'];
var startDate = {!Opportunity.Start_Date__c}; - this is a weird one I get a long number, but it's not the milliseconds, and it starts with 0.00049578....
var c = new sforce.SObject("Opportunity");
var startDate = c.Start_Date__c;
nothing works. I have a feeling I am very close, but can't quite get there. Any help apprechiated.
I am having issues getting value of the date field from the Opportunity object. I need to get Start date and End date, store them in a variable to send them as a part of an XMLH request. I have tried few things:
var startDate = [SELECT Start_Date__c FROM Opportunity where Id = 'XYZ'];
var startDate = {!Opportunity.Start_Date__c}; - this is a weird one I get a long number, but it's not the milliseconds, and it starts with 0.00049578....
var c = new sforce.SObject("Opportunity");
var startDate = c.Start_Date__c;
nothing works. I have a feeling I am very close, but can't quite get there. Any help apprechiated.
Opportunity opp = [SELECT Start_Date__c FROM Opportunity where Id = 'XYZ'];
Date startDate = opp.Start_Date__c;
startDate should hold the date value.
thank you for your response. I am coding behavoiur of a button, so I'm using OnClick Java script. When I try with your code I'm getting "Unexpected identifyer" error. Error is gone when I comment out Opportunity opp =[SELECT Start_Date__c FROM Opportunity where Id = 'XYZ"];. Alse is there a way to specify This Opportunity? So to pass the value of Start_Date__c button of the current opportunity to a variable?
this is what I have so far: