rbf_updateRecord() - Set Date/Time - Portal

Posted by IramK on 29-Jun-2016 09:30

Hello,

I am trying to set the date of a record using the rbf_updateRecord() function but its staying empty when I use the code below.

var currentDate = new Date();

var arr = [];

arr.dateField = currentDate; // Doesn't work

rbf_updateRecord("object", id, arr, true, function postUpdateCallback() { alert("Done"); }

When I use the code below it works so I'm thinking its something to do with the format. How can I know the format that I am supposed to set in a portal page?

arr.dateField = "29/06/2016, 15:28"; // Works

Cheers.

Iram

All Replies

Posted by ymaisonn on 29-Jun-2016 11:44

Hi Iram,

Can you retrieve the date format from the localization settings and use rbf_formatDate()?

var locContext = pageContext .getPageLocalization();
var d = locContext.getDateFormat();
var currentDate = new Date(); arr.dateField = rbf_formatDate(currentDate,d); rbf_updateRecord("trmt", {!id}, arr, true, function postUpdateCallback() { alert("Done"); });



Posted by IramK on 30-Jun-2016 03:25

Hello [mention:c44119a881b5487780a24bdb227e8dca:e9ed411860ed4f2ba0265705b8793d05] ,

Nope, pageContext is not defined for Portal pages. So anything to do with using rb.newui... etc wouldn't work. Is there any other way of retrieving the date format in Portal pages?

Iram

This thread is closed