Lesson 16: Request additional data from your user

From VZ Developer Wiki
Jump to: navigation, search

General Guidelines | XML Specification | Features | Views | JavaScript API | REST API | Tutorials | OAuth

Lesson 15: Embed Flash and interact with the OpenSocial API Back to overview Lesson 17: Send notifications to users

In some cases you may need data which the user has not provided in the vcard he associated with your app (e.g. E-Mail or Address) or data that is not available because of your Required Fields configuration. The following example shows how to direct the user to a edit page for his vcard where he can supplement the necessary information (see also Vz.vcard#vz.vcard.update).

function onLoadUser(data) {
   var owner = data.get('owner').getData();
   if (owner.getField('emails').length === 0) {
       alert('Please enter your email address');
       vz.vcard.update(function() {
       }, 'emails');

   //perform operation

function loadUser() {
    var req = opensocial.newDataRequest();
    var params ={};
    params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER,params), 'owner');


  • Lesson 16: Request additional data from your user