<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developer.myspace.com/Community/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Testing and Support</title><link>http://developer.myspace.com/Community/forums/16.aspx</link><description>Got code that just won't work? Discuss and troubleshoot here.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20910.1126)</generator><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42079.aspx</link><pubDate>Tue, 07 Jul 2009 16:30:04 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42079</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42079.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42079</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&amp;nbsp; I did both ... I&amp;#39;m not used to firebug... I tried it but I dont really know how to use it. &lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42064.aspx</link><pubDate>Mon, 06 Jul 2009 22:57:16 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42064</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42064.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42064</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I noticed nothing is happening with the recipients... Can you help?? ALSO - If an error is in javascript willl that cause all functions within the tags to not execute ?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42063.aspx</link><pubDate>Mon, 06 Jul 2009 22:48:34 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42063</guid><dc:creator>Chris Cole</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42063.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42063</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Make sure your app is set to 0.8 and not 0.7.&amp;nbsp; Then get set up with firebug and trace where it&amp;#39;s failing.&amp;nbsp; The code might have gotten mangled when it was pasted into the forums.&amp;nbsp; Also, you need to visit your app&amp;#39;sProfile page and manually install for some of the functionality to work.&amp;nbsp; It can&amp;#39;t always find your friends if the app isn&amp;#39;t installed.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42043.aspx</link><pubDate>Mon, 06 Jul 2009 06:08:50 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42043</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42043.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42043</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks for the BIG help ... i&amp;#39;m glad you took the time =]&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;... I tested it and it did not work &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42040.aspx</link><pubDate>Mon, 06 Jul 2009 05:42:44 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42040</guid><dc:creator>Chris Cole</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42040.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42040</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;There are some script errors in this code that need to be fixed first.&amp;nbsp; You have to close the array being declared as &amp;quot;&lt;b&gt;recipients&lt;/b&gt;&amp;quot;.&amp;nbsp; Also, what you&amp;#39;re doing with declaring &lt;b&gt;dataRequest &lt;/b&gt;as a variable, redefining it as a function, then internally reassigning it to an instance of a DataRequest is going to cause you trouble. It&amp;#39;s legal code, but is a bear to maintain and debug.&amp;nbsp; Additionally, the object &lt;b&gt;MyOpenSpace.DetailType &lt;/b&gt;is coming up undefined when I step the code, which is causing an exception to be thrown prior to performing the request.&amp;nbsp; I&amp;#39;d also encourage you to initialize the recipient list by registering the dataRequest initializer function with &lt;b&gt;gadgets.util.registerOnLoadHandler&lt;/b&gt; instead of making a direct inline call.&amp;nbsp; Additionally, the ID you&amp;#39;re using to get the friends does not work with 0.8.&amp;nbsp; The call to create the newFetchPeopleRequest is failing because &lt;span class="sourceRowText"&gt;opensocial.DataRequest.Group.VIEWER_FRIENDS is not defined.&amp;nbsp; You need to use the idSpec object instead.&amp;nbsp; You are also using an anonymous data request.&amp;nbsp; You&amp;#39;re much better off specifying a key so you can more easily retrieve the data.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Once I got through the main errors that were throwing exceptions, I found your paging to be wrong.&amp;nbsp; Paging must start from 1, not zero.&amp;nbsp; Once all that was fixed, the scope on your &lt;b&gt;recipients&lt;/b&gt; array was wrong.&amp;nbsp; It was declared in the callback handler, so was undefined when the rsaWrapper function called.&amp;nbsp; You need to scope it to the window object &lt;/p&gt;&lt;p&gt;The full OpenSocial Javascript docs may be found at opensocial.org.&lt;/p&gt;&lt;p&gt;&lt;a href="http://wiki.opensocial.org/index.php?title=JavaScript_API_Reference"&gt;http://wiki.opensocial.org/index.php?title=JavaScript_API_Reference&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;I would encourage you to use Firefox 3.5 with the latest Firebug, or to use IE8 with the built-in script debugger to trace these kinds of issues.&amp;nbsp; Inserting a &lt;b&gt;debugger&lt;/b&gt;; statement in the code will trigger the debugger to launch and break.&amp;nbsp; Most of your frustration is probably coming from using objects from the wrong OpenSocial version.&amp;nbsp; Also, don&amp;#39;t use document.write.&amp;nbsp; It has horrible performance and clears your page contents, which I don&amp;#39;t think is what you want.&amp;nbsp; Use the DOM api instead. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Soooooo.&amp;nbsp; Since I took the time to trace all this, here is the updated source code.&amp;nbsp; This is 0.8 compliant (you should no longer be using 0.7 anyway). Some of the examples on the site are from 0.7, so this is another gotcha.&lt;/p&gt;&lt;p&gt;---------------&lt;/p&gt;

&lt;pre&gt;&amp;lt;Multiple Invites&amp;gt;&lt;br /&gt;&amp;lt;script type=&amp;#39;text/javascript&amp;#39;&amp;gt;&lt;/pre&gt;&lt;pre&gt;//debugger;&lt;br /&gt;var os;&lt;br /&gt;var friendDataRequest;&lt;br /&gt;function initDataRequest()&lt;br /&gt;{&lt;br /&gt;//debugger;&lt;br /&gt;    os = opensocial.Container.get();&lt;br /&gt;    friendDataRequest= os.newDataRequest();&lt;br /&gt;    var friendsParams = {&lt;br /&gt;    }&lt;br /&gt;    ;&lt;br /&gt;    friendsParams[ opensocial.DataRequest.PeopleRequestFields.FILTER ] = opensocial.DataRequest.FilterType.ALL;&lt;br /&gt;    friendsParams[ opensocial.DataRequest.PeopleRequestFields.FIRST] = 1;&lt;br /&gt;    friendsParams[ opensocial.DataRequest.PeopleRequestFields.MAX ] = 10;&lt;br /&gt;/*&lt;br /&gt;    friendsParams[ MyOpenSpace.DetailType.GET_ONLINE ] = true;&lt;br /&gt;    friendsParams[ MyOpenSpace.DetailType.GET_STATUS ] = true;&lt;br /&gt;    friendsParams[ MyOpenSpace.DetailType.GET_MOOD ] = true;&lt;br /&gt;*/&lt;br /&gt;	var idparams = {};&lt;br /&gt;	idparams[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.VIEWER;&lt;br /&gt;	idparams[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.GroupId.FRIENDS;&lt;br /&gt;	var id = opensocial.newIdSpec(idparams);&lt;br /&gt;&lt;br /&gt;    var FRIENDSReq = os.newFetchPeopleRequest(id, friendsParams);&lt;br /&gt;    friendDataRequest.add(FRIENDSReq, &amp;quot;friends&amp;quot;);&lt;br /&gt;    friendDataRequest.send(getResponse);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var recipients = [;&lt;br /&gt;&lt;br /&gt;function getResponse(response)&lt;br /&gt;{&lt;br /&gt;//debugger;&lt;br /&gt;    if( response.hadError() )&lt;br /&gt;    {&lt;br /&gt;    	writeMessage(response.getErrorMessage());&lt;br /&gt;        return;&lt;br /&gt;    }&lt;br /&gt;    var VIEWER_FRIENDS = response.get(&amp;quot;friends&amp;quot;).getData().asArray();&lt;br /&gt;    for(var i=0; i gt;&amp;quot;);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;function multipleRSAWrapper(){&lt;br /&gt;//debugger;&lt;br /&gt;    // create the rSA message&lt;br /&gt;    var body = &amp;quot;Hey [recipient]! [sender] wants you to &amp;quot;;&lt;br /&gt;    body += &amp;quot;add [app]. It&amp;#39;s way awesome!&amp;quot;;&lt;br /&gt; &lt;br /&gt;    // create an opensocial.Message object&lt;br /&gt;    var reason = opensocial.newMessage(body);&lt;br /&gt; &lt;br /&gt;    // initiate requestShareApp&lt;br /&gt;    opensocial.requestShareApp(recipients, reason, function(){ writeMessage(&amp;#39;gt; SENT INVITES&amp;#39;); });&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function writeMessage(msg){&lt;br /&gt;    	var elem = document.getElementById(&amp;#39;msg&amp;#39;);&lt;br /&gt;        if(elem){&lt;br /&gt;        	elem.innerHTML += msg&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;gadgets.util.registerOnLoadHandler(initDataRequest);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;button  onclick=&amp;quot;multipleRSAWrapper();&amp;quot; &amp;gt;Multi Invite&amp;lt;/button&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;msg&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;


&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42038.aspx</link><pubDate>Mon, 06 Jul 2009 03:05:59 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42038</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42038.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42038</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;??? HELP&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42014.aspx</link><pubDate>Fri, 03 Jul 2009 13:23:47 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42014</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42014.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42014</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;any help???&lt;/p&gt;</description></item><item><title>Problem Multiple Invites</title><link>http://developer.myspace.com/Community/forums/thread/42007.aspx</link><pubDate>Fri, 03 Jul 2009 02:15:38 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:42007</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/42007.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=16&amp;PostID=42007</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m Trying to implement the new multiple Invites into my application ... I am trying allow users to invite the first ten friends to my app... ITS NOT WORKING -this is what I have so far... I think it should work but it doesnt &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;div id=&amp;#39;heading&amp;#39;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;hr size=&amp;quot;1px&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;var os;&lt;br /&gt;var dataRequest;&lt;br /&gt;function dataRequest()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; os = opensocial.Container.get();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataRequest = os.newDataRequest();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var friendsParams = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ opensocial.DataRequest.PeopleRequestFields.FILTER ] = opensocial.DataRequest.FilterType.ALL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ opensocial.DataRequest.PeopleRequestFields.FIRST] = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ opensocial.DataRequest.PeopleRequestFields.MAX ] = 10;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ MyOpenSpace.DetailType.GET_ONLINE ] = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ MyOpenSpace.DetailType.GET_STATUS ] = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; friendsParams[ MyOpenSpace.DetailType.GET_MOOD ] = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var FRIENDSReq = os.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS, friendsParams);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataRequest.add(FRIENDSReq);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataRequest.send(getResponse);&lt;br /&gt;}&lt;br /&gt;function getResponse(response)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( response.hadError() )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.write(&amp;quot;There is an error in the response. &amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;var recipients;&lt;br /&gt;recipients = [;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var VIEWER_FRIENDS = response.get(opensocial.DataRequest.Group.VIEWER_FRIENDS).getData().asArray();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(var i=0; i &amp;lt; VIEWER_FRIENDS.length; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;recipients.push(VIEWER_FRIENDS&lt;img src="http://developer.myspace.com/Community/emoticons/emotion-55.gif" alt="Idea" /&gt;.getField(opensocial.Person.Field.ID))&lt;br /&gt;document.write(VIEWER_FRIENDS&lt;img src="http://developer.myspace.com/Community/emoticons/emotion-55.gif" alt="Idea" /&gt;.getField(opensocial.Person.Field.ID)+&amp;quot; &amp;quot;+recipients+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;document.write(&amp;#39;&amp;lt;input type =&amp;quot;button&amp;quot; onclick=&amp;quot;multipleRSAWrapper();&amp;quot; value=&amp;quot;jjjg&amp;quot;&amp;gt;&amp;#39;);&lt;br /&gt;}&lt;br /&gt;function multipleRSAWrapper(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create the rSA message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var body = &amp;quot;Hey [recipient]! [sender] wants you to &amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; body += &amp;quot;add [app]. It&amp;#39;s way awesome!&amp;quot;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create an opensocial.Message object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var reason = opensocial.newMessage(body);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // initiate requestShareApp&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; opensocial.requestShareApp(recipients, reason, function(){ alert(&amp;#39;done&amp;#39;); });&lt;br /&gt;}&lt;br /&gt;dataRequest();&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;</description></item></channel></rss>