Nick6231698
Posts: 0
Joined: Thu Sep 12, 2013 5:25 pm

Trouble using local storage variable in Salesforce Integration soql query

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble using local storage variable in Salesforce Integration soql query

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble using local storage variable in Salesforce Integration soql query

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

Nick6231698
Posts: 0
Joined: Thu Sep 12, 2013 5:25 pm

Trouble using local storage variable in Salesforce Integration soql query

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

Nick6231698
Posts: 0
Joined: Thu Sep 12, 2013 5:25 pm

Trouble using local storage variable in Salesforce Integration soql query

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble using local storage variable in Salesforce Integration soql query

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

Nick6231698
Posts: 0
Joined: Thu Sep 12, 2013 5:25 pm

Trouble using local storage variable in Salesforce Integration soql query

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. :)

Nick6231698
Posts: 0
Joined: Thu Sep 12, 2013 5:25 pm

Trouble using local storage variable in Salesforce Integration soql query

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. :)

Pavan Varma
Posts: 0
Joined: Thu Mar 19, 2015 7:02 am

Trouble using local storage variable in Salesforce Integration soql query

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?

Return to “Issues”