Hi,
I don't know much about MS CRM3, but a quick look at your code and I
have some suggestions. I notice that you are dynamically loading in
the jsapi loader to bring in the Google Data JS library. This is not
recommended, as part of the logic depends on the window.onload to
trigger initialization, therefore it is recommended that you should
statically load it using <script> tag on your HTML page. Other than
that, perhaps place some debug statement to see how far your code can
run and whether the Google Data library is actually loaded.
Hope that helps,
Austin
On Fri, Apr 18, 2008 at 11:58 AM, Jason Bell <[EMAIL PROTECTED]> wrote:
>
> I am using Microsoft CRM3 to call a function from a form onLoad event
> to Write an event to GCal. Doesn't produce an error and no event is
> written to GCal. Any help is appreciated!
>
> onLoad of crm form=
>
> var script = document.createElement('script');
> script.language = 'javascript';
> script.src = '/scripts/customScripts.js';
> document.getElementsByTagName('head')[0].appendChild(script);
>
> var f = function()
> {
> if (event.srcElement.readyState == "loaded")
> CreateGCalEvent(); // function from customScripts.js
> }
>
> script.attachEvent("onreadystatechange", f);
>
>
> Function on Server=
>
> function CreateGCalEvent()
> {
> <script type="text/javascript"
> src="http://www.google.com/jsapi?key=
>
> ABQIAAAAxCj--9cuKo3gGZgMIj9Z1BSvUcjsuL39YnMLr97V9qIPoAIXuBR2uEYNHpn4d3FkkFnpnrC14L_-0g">
> </script>
> google.load("gdata", "1");
> google.setOnLoadCallback(getMyFeed);
> var myService;
> var feedUrl = "http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/
> public/full";
>
> function setupMyService() {
> myService =
> new google.gdata.calendar.CalendarService('exampleCo-
> exampleApp-1');
> }
>
> function getMyFeed() {
> setupMyService();
>
> myService.getEventsFeed(feedUrl, handleMyFeed, handleError);
> }
> function handleMyFeed(myResultsFeedRoot) {
> alert("This feed's title is: " +
> myResultsFeedRoot.feed.getTitle().getText());
> }
>
> function handleError(e) {
> alert("There was an error!");
> alert(e.cause ? e.cause.statusText : e.message);
> }
>
>
> // Create the calendar service object
> var calendarService = new
> google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0');
>
> // The default "private/full" feed is used to insert event to the
> // primary calendar of the authenticated user
> var feedUri = 'http://www.google.com/calendar/feeds/default/private/
> full';
>
> // Create an instance of CalendarEventEntry representing the new event
> var entry = new google.gdata.calendar.CalendarEventEntry();
>
> // Set the title of the event
> entry.setTitle(google.gdata.Text.create('MSCRM'));
>
> // Create a When object that will be attached to the event
> var when = new google.gdata.When();
>
> // Set the start and end time of the When object
> var startTime =
> google.gdata.DateTime.fromIso8601("2008-04-30T09:00:00.000-08:00");
> var endTime =
> google.gdata.DateTime.fromIso8601("2008-04-30T10:00:00.000-08:00");
> when.setStartTime(startTime);
> when.setEndTime(endTime);
>
> // Add the When object to the event
> entry.addTime(when);
>
> // The callback method that will be called after a successful
> insertion from insertEntry()
> var callback = function(result) {
> PRINT('event created!');
> }
>
> // Error handler will be invoked if there is an error from
> insertEntry()
> var handleError = function(error) {
> PRINT(error);
> }
>
> // Submit the request using the calendar service object
> calendarService.insertEntry(feedUri, entry, callback,
> handleError, google.gdata.calendar.CalendarEventEntry);
>
> }
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---