Guest User

Untitled

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