• Aurélien Laval
  • NEWBIE
  • 50 Points
  • Member since 2013

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies

Hello, I develop en an Android application with the Salesforce Mobile SDK to store datas offline in using smartstore.

I saw the Mobile SDK Workbook but it's not said how store manually datas with smartstore.

Per example, I want when a user populate a form and submit it, store form's informations in the mobile with smartstore and I don't how do it.

In this time, I tried this :

function Track(){
    this.Id = null;
    this.Name = null;
    this.Price__c = null;
    this.Album__c = null;
    this.Album__r = null;
}

function Album(){
    this.Id = null;
    this.Name = null;
}

var track = new Track();
track.Id = $j('#idInput').val();
track.Name = $j('#nameInput').val();
track.Price__c = $j('#priceInput').val();
track.Album__c = $j('#albumIdInput').val();
track.Album__r = new Album();
track.Album__r.Id = $j('#albumIdInput').val();
track.Album__r.Name = "A name";

var myTable = [];
myTable.push(track);

addOfflineTracks(JSON.stringify(myTable), successAdd, errorAdd);

 

I get an error :

http://nsa33.casimages.com/img/2013/08/12/130812124002327909.png

 

 

I guess than I don't give the good datas to store with smartstore because when datas are loaded from a Salesforce controller, a list is given to store and I use a table.

How can I use a list en Javascript please?

 

Sorry if I use a bad language.

Hello, I develop a chart and I use an objet 'Data' with fields : 'name', 'data1', 'data2' and 'data3'.

This chart represents statistics by date for this year, the last year and the last year yet.

It's possible that for one year, I don't have value (data1, data2 or data3) to give for my chart.

What value can I give to my Data object for that my chart works and the missed value dosen't be execute as a 0?

For example, in this tutorial, if in the third chart, I don't have value for february, how can I do for it skips to the next value (january => march)?

Hello, I am developping the CloudTunes hybrid applicationon for Android to test the offline datas and I've a problem with the data stockage.

 

When I try to store offline, I've this message : Class not found

 

I guess is not normal but I don't understand why?

 

The  error is in this function :

[code]

function regOfflineSoups() {

   if (hasSmartstore()) {
      var smartStore = cordova.require("salesforce/plugin/smartstore");
      alert("Registering soups");
      console.log("Registering soups");

      //Registering soup 1 for storing albums
      var indexesAlbums = [
         {path:"Name",type:"string"},
         {path:"Id",type:"string"}
      ];

      smartStore.registerSoup(ALBUMS_SOUP_NAME, indexesAlbums, onSuccessRegSoup, onErrorRegSoup);

      //Registering soup 2 for storing tracks
      var indexesTracks = [
         {path:"Name",type:"string"},
         {path:"Id",type:"string"},
         {path:"Album__c",type:"string"},
         {path:"Price__c",type:"string"}
      ];
      smartStore.registerSoup(TRACKS_SOUP_NAME,
      indexesTracks,
      onSuccessRegSoup,
      onErrorRegSoup);
   }
}

[/code]

 

I don't have the alert "Registering soups";

 

The error is the variabble smartStore doesn't has the file "salesforce/plugin/smartstore"?

Where sould be this file?

 

In my assets files in Eclipse? i've :

- bootconfig.js

- bootstrap.html

- cordova-2.3.0.js

- SalesforceOAuthPlugin.js

- SFHybridApp.js

- folder jquery

 

In Salesforce :

[code]

<apex:includeScriptvalue="{!URLFOR($Resource.cloudtunes_offline)}"/>

 

<apex:variablevar="cdvUrl"value="{!cordovaUrl}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.Cordova, cdvUrl)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.SFHybridAppJs)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.SFSmartStorePlugin)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.cloudtunes_smartstore)}"/>

[/code]

 

Thanks for your answers.

Hello, I've created a customer portal and 2 users which use 2 different custom profiles (cloned from "Customer Portal Manager Custom" profile).

 

For my profiles, I've created 2 different roles in the same branch (for the hierarchy).

 

But, when, I see the roles of my 2 contacts, they are different and I can't choose them I want, they have a "Customer Portal Manager Custom" licence, how can I attribute them, the roles I created?

 

Thanks for your answers and sorry for my language.

Hello,

 

First, I'm sorry if I have a bad language.

 

I am trying to do the Cloud Tunes project (Mobile SDK Workbook) with objects Album__c and Track__c. I have modified to add/modify datas in Salesforce and to store offline data manually.

 

The problem is when I wish store an offline track manually, I use this code :

[code]

var TRACKS_SOUP_NAME = "ct__tracksSoup";

 

function regOfflineSoups() {
if (hasSmartstore()) {
var smartStore = cordova.require("salesforce/plugin/smartstore");
console.log("Registering soups");

//Registering soup 2 for storing tracks

var indexesTracks = [
{path:"Name",type:"string"},
{path:"Id",type:"string"},
{path:"Album__c",type:"string"}
];
smartStore.registerSoup(TRACKS_SOUP_NAME,
indexesTracks,
onSuccessRegSoup,
onErrorRegSoup);
}

 

function addOfflineTracks(entries, success, error) {
if (hasSmartstore()) {
var smartStore = cordova.require("salesforce/plugin/smartstore");
smartStore.upsertSoupEntries(TRACKS_SOUP_NAME,entries,
success,
error);
}
}


}

function Track(){
this.Id = null;
this.Name = null;
this.Price__c = null;
this.Album__c = null;
}

 

function parseJsonPerso(track){
return {"Name" : track.Name, "Id" : track.Id, "Album__c" : track.Album__c};
}

 

var track = new Track();

track.Name = 'name';

track.Album__c = '1234567890azert';

addOfflineTracks(new Array(parseJsonPerso(track)), sucessCallback, displayError);

[/code]

 

Then, I get this error:

[quote]

processMessage failed: Error: SyntaxError: Unable to parse JSON string at https://c.na15.visual.force.com/resource/1370942151000/Cordova/cordova-android.js:1091

[/quote]

 

What can I do to fix that please?

 

Thanks for your answers.

Hello,

 

Is possible to modify the detail page layout of an object from a Canvas App?

 

Example, I have a canvas app in a visualforce page and I wish modify the style of a object's field in Salesforce with jQuery code from the canvas app like that :

$("#name").css( "color", "red" );

 

 

Thanks

Hello, I develop en an Android application with the Salesforce Mobile SDK to store datas offline in using smartstore.

I saw the Mobile SDK Workbook but it's not said how store manually datas with smartstore.

Per example, I want when a user populate a form and submit it, store form's informations in the mobile with smartstore and I don't how do it.

In this time, I tried this :

function Track(){
    this.Id = null;
    this.Name = null;
    this.Price__c = null;
    this.Album__c = null;
    this.Album__r = null;
}

function Album(){
    this.Id = null;
    this.Name = null;
}

var track = new Track();
track.Id = $j('#idInput').val();
track.Name = $j('#nameInput').val();
track.Price__c = $j('#priceInput').val();
track.Album__c = $j('#albumIdInput').val();
track.Album__r = new Album();
track.Album__r.Id = $j('#albumIdInput').val();
track.Album__r.Name = "A name";

var myTable = [];
myTable.push(track);

addOfflineTracks(JSON.stringify(myTable), successAdd, errorAdd);

 

I get an error :

http://nsa33.casimages.com/img/2013/08/12/130812124002327909.png

 

 

I guess than I don't give the good datas to store with smartstore because when datas are loaded from a Salesforce controller, a list is given to store and I use a table.

How can I use a list en Javascript please?

 

Sorry if I use a bad language.

Hello, I am developping the CloudTunes hybrid applicationon for Android to test the offline datas and I've a problem with the data stockage.

 

When I try to store offline, I've this message : Class not found

 

I guess is not normal but I don't understand why?

 

The  error is in this function :

[code]

function regOfflineSoups() {

   if (hasSmartstore()) {
      var smartStore = cordova.require("salesforce/plugin/smartstore");
      alert("Registering soups");
      console.log("Registering soups");

      //Registering soup 1 for storing albums
      var indexesAlbums = [
         {path:"Name",type:"string"},
         {path:"Id",type:"string"}
      ];

      smartStore.registerSoup(ALBUMS_SOUP_NAME, indexesAlbums, onSuccessRegSoup, onErrorRegSoup);

      //Registering soup 2 for storing tracks
      var indexesTracks = [
         {path:"Name",type:"string"},
         {path:"Id",type:"string"},
         {path:"Album__c",type:"string"},
         {path:"Price__c",type:"string"}
      ];
      smartStore.registerSoup(TRACKS_SOUP_NAME,
      indexesTracks,
      onSuccessRegSoup,
      onErrorRegSoup);
   }
}

[/code]

 

I don't have the alert "Registering soups";

 

The error is the variabble smartStore doesn't has the file "salesforce/plugin/smartstore"?

Where sould be this file?

 

In my assets files in Eclipse? i've :

- bootconfig.js

- bootstrap.html

- cordova-2.3.0.js

- SalesforceOAuthPlugin.js

- SFHybridApp.js

- folder jquery

 

In Salesforce :

[code]

<apex:includeScriptvalue="{!URLFOR($Resource.cloudtunes_offline)}"/>

 

<apex:variablevar="cdvUrl"value="{!cordovaUrl}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.Cordova, cdvUrl)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.SFHybridAppJs)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.SFSmartStorePlugin)}"/>

<apex:includeScriptvalue="{!URLFOR($Resource.cloudtunes_smartstore)}"/>

[/code]

 

Thanks for your answers.

Hello, I've created a customer portal and 2 users which use 2 different custom profiles (cloned from "Customer Portal Manager Custom" profile).

 

For my profiles, I've created 2 different roles in the same branch (for the hierarchy).

 

But, when, I see the roles of my 2 contacts, they are different and I can't choose them I want, they have a "Customer Portal Manager Custom" licence, how can I attribute them, the roles I created?

 

Thanks for your answers and sorry for my language.

Hello,

 

First, I'm sorry if I have a bad language.

 

I am trying to do the Cloud Tunes project (Mobile SDK Workbook) with objects Album__c and Track__c. I have modified to add/modify datas in Salesforce and to store offline data manually.

 

The problem is when I wish store an offline track manually, I use this code :

[code]

var TRACKS_SOUP_NAME = "ct__tracksSoup";

 

function regOfflineSoups() {
if (hasSmartstore()) {
var smartStore = cordova.require("salesforce/plugin/smartstore");
console.log("Registering soups");

//Registering soup 2 for storing tracks

var indexesTracks = [
{path:"Name",type:"string"},
{path:"Id",type:"string"},
{path:"Album__c",type:"string"}
];
smartStore.registerSoup(TRACKS_SOUP_NAME,
indexesTracks,
onSuccessRegSoup,
onErrorRegSoup);
}

 

function addOfflineTracks(entries, success, error) {
if (hasSmartstore()) {
var smartStore = cordova.require("salesforce/plugin/smartstore");
smartStore.upsertSoupEntries(TRACKS_SOUP_NAME,entries,
success,
error);
}
}


}

function Track(){
this.Id = null;
this.Name = null;
this.Price__c = null;
this.Album__c = null;
}

 

function parseJsonPerso(track){
return {"Name" : track.Name, "Id" : track.Id, "Album__c" : track.Album__c};
}

 

var track = new Track();

track.Name = 'name';

track.Album__c = '1234567890azert';

addOfflineTracks(new Array(parseJsonPerso(track)), sucessCallback, displayError);

[/code]

 

Then, I get this error:

[quote]

processMessage failed: Error: SyntaxError: Unable to parse JSON string at https://c.na15.visual.force.com/resource/1370942151000/Cordova/cordova-android.js:1091

[/quote]

 

What can I do to fix that please?

 

Thanks for your answers.