Hi All,
Very new to OutSystems. I'm trying to use the documentation for adding a scheduler through the Nylas platform, but I can't figure out how to implement steps 1 & 2 in Service Studio. I can't seem to find a place to add an id tag to a button, or insert the html script on that screen. Any help would be greatly appreciated.
-Daniel
I found the answer from this video. It said to add an OnReady event to the screen to require the script, and then you can just add the script URL to that event and that worked!
I'm also admittedly not well versed in JavaScript. However, I deleted the first few lines of the JavaScript in the Nylas docs and got an error that said "nylas is not defined." So, similar question to above, how do I run <script src="https://schedule.nylas.com/schedule-editor/v1.0/schedule-editor.js" type="text/javascript"></script> on that screen?
Hi Daniel,
For Step-1:
Add your js file of in Scripts folder in the Interface tab of your application in Service Studio. I mean download this file from browser and save it with any name. Upload it in your module from service studio. Reference this file in your screen / webblock from the Required Scripts section.
For Step-2:
Create a button on the interface, name it anything, MyButtonScheduleEditor. Add a click event Client Action, so you can implement your javascript here.
For Step-3:
In click even, add JavaScript element from left side toolbox. Add the following script:
nylas.scheduler.show({ auth: { // Account with active calendar scope accessToken: "xFl3gbNgR0MDAM4DysONfkekDcy3Co", }, style: { // Style the schdule editor tintColor: '#32325d', backgroundColor: 'white', }, defaults: { event: { title: '30-min Coffee Meeting', duration: 30, }, }, });
That's all!
Hey @Ravi Punjwani , thanks for the reply! I followed your steps and I'm still getting an error when I open that screen in the browser. It's the same "nylas is not defined" error, which to me seems like the script in the Required Scripts option isn't running, since that's where the nylas function is defined. I'm doing this in my personal environment and I tried saving the script as a .js file and uploading it to the Scripts folder on the Interface tab, and also tried just creating a new script in that folder and copy and pasting the content of the .js. Both threw up the same "nylas is not defined" error.
What do you think?