I'm getting this error while applied java script on getting month and year from date only field.
Value should be of type: Date: Parameter Name: value
please help me to resolve this.
I'm getting this error while applied java script on getting month and year from date only field.
Value should be of type: Date: Parameter Name: value
please help me to resolve this.
Hi Diksha,
Please try this function,
function getDateField(e){
// Get the Form Context
var formContext = e.getFormContext();
// Get the value of the Opportunity Est. Close Date
var date = formContext.getAttribute("estimatedclosedate").getValue();
if (date != null) {
var day = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
month++;
// Add leading 0's to single digit days and months
if (day < 10) {day = "0" + day;}
if (month < 10) {month = "0" + month;}
// Create a variable with the formatted date as MM/DD/YYYY
var formattedDate = month + "/" + day + "/" + year;
// Create a variable with the formatted date as DD/MM/YYYY
//var formattedDate = date + "/" + month + "/" + year;
}
}
Please mark the answer as verified if that's resolve your problem.
Hi Diksha Kanwar,
What code you are using right now to get the value? can you please share it?
If I answer your question then please mark it as verified.
Let me know if I can provide you with more details.
Thanks
Regards,
Abdul Wahab
Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp:+923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: www.linkedin.com/.../
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal...
284,876
Super User
Ludwig Reinhard Microsoft Employee
Martin Dráb
225,425
Super User