Page 1 of 3

Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 10:59 am
by Nick6231698

I'm fairly new to queries and to mobile app development. I'm currently trying to make an app that will show a list of warehouses (currently works - creates a list of possible warehouse choices). The app then takes the selection and stores the unique salesforce id of the warehouse into a local storage variable. I then want to go to another page to show a list of items in that warehouse (basically I want to list out the items of a related list from salesforce).

Here is what I have for my query request parameters:
SELECT Id, Name, Productr.Name FROM Inventoryc WHERE Warehousec={Warehouser.Id}

Here is what I get in the test data screen:

{
"status":"400 Bad Request",
"url":"https://dac.my.salesforce.com/service...",
"response":[
{
"message":"\nInventoryc WHERE Warehousec=\n \nERROR at Row:1:Column:70\nunexpected token: ''",
"errorCode":"MALFORMED_QUERY"
}
]
}

Note: For some reason when I paste the data in here it cuts < EOF from after the unexpected token part.

I've also included a screenshot:
Image

Any thoughts what I'm doing wrong?

Thanks,

Nick


Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 11:47 am
by Maryna Brodina

Hello! Working on it...


Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 2:31 pm
by Maryna Brodina

We reproduced this issue, developers are researching this problem. I'll let you know when have more information.


Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 3:04 pm
by Maryna Brodina

It won't work this way, you have to use JS in mapping to pass parameters.


Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 4:45 pm
by Nick6231698

Okay. When I do that am I supposed to put the Query statement in the area for Edit JS? I guess that I have been confused as to what syntax to use in that function{value}. Would you know the basics or know an example that I could look at? - Thanks so much for all of your help and for looking into it! Nick


Trouble using local storage variable in Salesforce Integration soql query

Posted: Tue Nov 05, 2013 8:00 pm
by Nick6231698

I took a stab at trying to use JS to map. I got an error saying Unexpected Identifier in my console log.

What I did:
I deleted the query statement from the q request field. I then went to the mapping screen and clicked edit js next to the q parameter.

Here was the code that I had tried to use that gave the error:
var warehouseInventory = Appery(localStorage.warehouseId);
“SELECT Id, Name, Productr.Name FROM Inventoryc where Warehouse__c =’”+ warehouseInventory +”‘”;

Am I even on the right track?

Nick


Trouble using local storage variable in Salesforce Integration soql query

Posted: Wed Nov 06, 2013 11:54 am
by Maryna Brodina

Hello! If warehouseId is a localStorage variable it's better to use the following code:
prevar warehouseInventory = localStorage&#46;getItem("warehouseId");
return "SELECT Id, Name, Productr&#46;Name FROM Inventoryc where Warehouse__c ='"+ warehouseInventory +"'";/pre


Trouble using local storage variable in Salesforce Integration soql query

Posted: Wed Nov 06, 2013 9:33 pm
by Nick6231698

Thank you so much Maryna! It worked perfectly and is a model that I'm sure that I will use many times in the future.

I really appreciate all of your help! It is great that the staff take so much time to answer every question. This has truly been a great place to be able to learn while doing. :)


Trouble using local storage variable in Salesforce Integration soql query

Posted: Wed Nov 06, 2013 9:33 pm
by Nick6231698

Thank you so much Maryna! It worked perfectly and is a model that I'm sure that I will use many times in the future.

I really appreciate all of your help! It is great that the staff take so much time to answer every question. This has truly been a great place to be able to learn while doing. :)


Trouble using local storage variable in Salesforce Integration soql query

Posted: Thu Mar 19, 2015 11:33 am
by Pavan Varma

I don't see edit js next to the q parameter. Could you please point me to where I have to write the javascript code for query?