Custom Object similar to Events - how to recreate Recurrence Functionality

  • 1
  • Question
  • Updated 5 years ago
  • Answered
Archived and Closed

This conversation is no longer open for comments or replies and is no longer visible to community members. The community moderator provided the following reason for archiving: Fixed bugs and duplicate tickets

Due to the limitations of the standard Event Object, I had to create my own custom object that would function as a replacement. I need to recreate the recurrence functionality as follows:

For datetime input - StartTime & EndTime
Var LoopDateTime = StartTime
Loop - Add 7 days to LoopDateTime
Until LoopDateTime is greater than the EndTime

I don't know how to make this work in Skuid. Any tips?
Photo of Griffin Brown

Griffin Brown

  • 2,818 Points 2k badge 2x thumb
  • stumped

Posted 5 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,686 Points 5k badge 2x thumb
Try a Javascript snippet like this:

var $ = skuid.$;var m = skuid.model.getModel('YourInputModel'); 
var row = m.getFirstRow(); 
//reference the start and end fields
var startTime = row.Start_Time__c;
var endTime = row.End_Time__c;
//convert the Salesforce dates into Javascript dates
var jsStartDate = skuid.time.parseSFDateTime(startTime);
var jsEndDate = skuid.time.parseSFDateTime(endTime);
var loopDateTime = startTime;
// loop through adding 7 days until the start is greater than the end
while(loopDateTime < EndTime){
// the exact syntax is a little tricky check out this link
loopDateTime.setDate(loopDateTime.getDate() + 7);

This conversation is no longer open for comments or replies.