Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onSubmitofRecordEditForm:function(component, event, helper)
- {
- var recordEditFormList = component.find("newFormtoUpdate");
- // get all fields using event.getParam("fields") and set some field values in the backend onsubmit of the recordEditForm
- var eventFields = event.getParam("fields");
- var timezone = $A.get("$Locale.timezone");
- console.log('Time Zone Preference in Salesforce ORG :'+timezone);// Result::: Time Zone Preference in Salesforce ORG :America/New_York
- var mydate = new Date().toLocaleString("en-US", {timeZone: timezone})
- console.log('Date Instance with Salesforce Locale timezone : '+mydate);// Result::: Date Instance with Salesforce Locale timezone : 1/20/2019, 11:14:03 AM
- var date = mydate.replace(/,/, '');
- var lastModifiedDate = date.replace(/:[0-9]{2}s/, ' ');
- console.log(lastModifiedDate); // Result ::: 1/20/2019 11:14 AM
- //salesforce field format is 1/20/2019 11:14 AM
- // not able to set the vale and throw error saying
- /* {"message":"Value for field 'DNC_Call_Date__c' is not in ISO 8601 format, Value: 1/20/2019 11:19 AM,
- Runtime class: java.lang.String","detail":"","output":{},"error":{"type":"TRANSPORT_ERROR","details":{}}}*/
- eventFields["DNC_Call_Date__c"] = lastModifiedDate;
- // global function submit used to submit the recordEditForm
- recordEditFormList.submit(eventFields);
- }
Add Comment
Please, Sign In to add comment