Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Update Predefined Collections using server script

Hello

Code: Select all

I am trying to update the PREDEFINED COLLECTION DEVICES using SERVER CODE SCRIPT. 

The problem is I do not know how to access the predefined collections. I am running the code manually once and a while and I am not concerned about security) 

This is my current code.

//Name of the collection that you are targeting
var collection = "Devices";
var dbId = "5...";

var token = '5....';

var result = Collection.multiUpdateObject(dbId, collection, '{channels: "OLD"}', {"channels ":"NEW"});

Apperyio.response.success(result, "application/json");

This is my ERROR MESSAGE
Error code SCSE014: Script execution failed. Details have been added to Trace tab.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Update Predefined Collections using server script

Hello Vinny,

This collection is not available in the method "multiUpdateObject".

Please use a direct XHR2 request (https://docs.appery.io/v2.4.0/referen...)
to update devices. Here you can find an example of the request: https://docs.appery.io/reference#push...

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Update Predefined Collections using server script

That does not really help me. (im too much of a novice)

Is it possible to update multiple rows in the device database? im trying to add a channel to ALL the users without having to click a button 5000 times.

Vinny

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Update Predefined Collections using server script

Could you please clarify what you have tried and what exactly does not work?

No, it is not possible to do for all of them by only one call. Please run the update service for all devices with a some custom code

Return to “Issues”