Create an ICS file to create a calendar event in Outlook
Question
Application Type
Reactive
Service Studio Version
11.11.2 (Build 42828)

I am using a Javascript js ICS to create the calendar event in Outlook but a have a problem with the RRule part of adding the event to outlook. No matter how I pass the RRule parameter to the javascript script it keeps returning the following error "Recurrence rrule frequency must be provided and be one of the following: 'YEARLY', 'MONTHLY', 'WEEKLY', or 'DAILY'".

According to this url https://jakubroztocil.github.io/rrule/ the RRule should look like this.

rule =
new RRule({
  freq: RRule.MONTHLY,
  count: 30,
  interval: 1,
  byweekday: [RRule.TU, RRule.WE],
  bymonth: [2, 3]
})

I have tried the following:

I then assign values to the a_RRule and then call  JSONSerialize to create the object. Then I pass the output of the JSONSerialize to the correct parameter of the Javascript?

Any suggestions on how I can pass the RRule parameter to the javascript?


mvp_badge
MVP

Hi Chris,


One thing you can try and which is often used to workaround limitations in JSON serialization is to apply Regex to tweak the string to precisely match your use case. For that, you can use the Regex_Replace function from Text extension.


Kind Regards,
João

Thank you, João.

After some analysis of the Javascript, I came to the conclusion that the javascript "Object" could be set as a string. This does work but the javascript does not do what I expected it should do so this changes the problem entirely. Since the javascript is not my code I cannot copy and paste part of the script in this post. It wouldn't seem ethical.

The string I pass to the script however can be pasted just to explain what this post was all about.

"DTSTART:20210501T220000Z
RRULE:FREQ=WEEKLY;UNTIL=20210530T220000Z;INTERVAL=1;COUNT=20;BYDAY=MO,TU"

It represents a so-called recurrence event to register an event in an Outlook Calendar. The object is called RRule.

Kind regards,

Chris

 

Hey Chris

I am not sure if this can be helpful, in my experience with serializing data I have found that at times of using a record structure it creates a serialization with the record name and then its values. 

Example: 

"Customer":{

   "Name":"Ashish",

   "Occupation":"Consulting"

}

Instead of serializing only the attributes like

{

   "Name":"Ashish",

   "Occupation":"Consulting"

}

You can maybe log the serialized output on the console of the browser or you could debug the code. If there is a problem with the serialized JSON and it needs some amendments you can use the Regex_Replace mentioned above. 

I am not sure about the JS Code you are referring to if this is something you have already checked and there is some other issues do let me know, here and maybe we can resolve it.

Thanks


Thank you, Ashish.

I'll try logging it to the console. That'll certainly gain some insight. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.