Skip to main content
Nintex Community Menu Bar
Question

Date field using custom field renderer snippet has stopped working

  • July 10, 2024
  • 5 replies
  • 0 views
  • Translate

Forum|alt.badge.img+4

Date field using custom field renderer snippet has stopped working. It used to work fine before. Now it has stopped working and gives an error message saying required field value is not populated when trying to save the record.

Below is the snippet:

var field = arguments[0], value = arguments[1]; //set Contract expiry date to 365 days from today var c=new Date(); c.setDate(c.getDate()+365); var cYear=c.getFullYear(); var cMonth=c.getMonth()+1; var cDay=c.getDate(); value = cYear+"-"+cMonth+"-"+cDay; skuid.ui.fieldRenderers.DATE.edit( field, value );<br>
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img+17
  • Nintex Employee
  • 3763 replies
  • July 10, 2024

Try setting a console log on the “Value” output.  Then compare that with model data for a date returned from salesforce. It looks like you are trying to parse your own salesforce date from the javascript date provided by your +365 calculation.  You should look into some of Skuid Time APIs that perform this parsing function more reliably.  http://help.skuidify.com/m/11720/l/129505-skuid-time 

Translate

Forum|alt.badge.img+13

Jayesh I am surprised that this was ever “working”, because the snippet above never actually updates the value of the Date field in the Skuid Model — in the UI the value might have shown as the Date you were creating, but you need to use model.updateRow() (see the docs on the Model object) to actually change the value of the field in the Model.

Translate

Forum|alt.badge.img+4

What I am trying to do is default today’s date + 365 as the expiration date of a contract. But the user should be able to override it. So i built the above custom field render snippet. This defaults the date correctly.

But if I understand correctly I need to use an updateRow to actually save it on the model even before the user clicks the save button?

Translate

Forum|alt.badge.img+13

Yes that is correct, you need to use updateRow to save it to the Model.

Translate

Forum|alt.badge.img+4

That resolved the problem. Thanks.

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings