Page 1 of 1

UserManager additionalInfo

PostPosted: Mon Jun 04, 2018 2:19 pm
by andre1506345542
Hi

When I use the UserManager plugin and I assign an array to additionalInfo, and afterwards when I try to retrieve the information (in the same client or or other client) I get an an array object code (or how you call).

input array: [[clientId, 9D429C09-84A3-45F3-BB02-E6E2BA336B7C], [solution, cds_batch], [start date, ma, 4 jun 2018 14:11:42]]

This is what I get
[[Ljava.lang.Object;@503eb19b, [Ljava.lang.Object;@3266d898, [Ljava.lang.Object;@1d571ce0]

How do I get my original array back. Does this has something to do with HashMaps. And how does that work.

Thanks

Re: UserManager additionalInfo

PostPosted: Mon Jun 04, 2018 5:17 pm
by mboegem
Hi,

I've ran into a similar thing.
I resolved it by creating an object and convert that to JSON, and vice versa when reading it.
In order to set it:
Code: Select all
var myInfo = {"clientId":"9D429C09-84A3-45F3-BB02-E6E2BA336B7C", "solution":"cds_batch", "start_date":new Date()};
plugins.UserManager.Client().additionalInfo = [JSON.stringify(myInfo)];


and read:
Code: Select all
var myJSON = plugins.UserManager.Client().additionalInfo[0];
var myInfo = JSON.parse(myJSON);
var clientId = myInfo.clientId;


Hope that helps

Re: UserManager additionalInfo

PostPosted: Tue Jun 05, 2018 10:10 am
by andre1506345542
Thanks Marc,
That works like a charm
Andre