UserManager additionalInfo

Questions, tips and tricks and techniques for scripting in Servoy

UserManager additionalInfo

Postby andre1506345542 » Mon Jun 04, 2018 2:19 pm

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
andre1506345542
 
Posts: 42
Joined: Mon Sep 25, 2017 3:19 pm

Re: UserManager additionalInfo

Postby mboegem » Mon Jun 04, 2018 5:17 pm

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
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1800
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: UserManager additionalInfo

Postby andre1506345542 » Tue Jun 05, 2018 10:10 am

Thanks Marc,
That works like a charm
Andre
andre1506345542
 
Posts: 42
Joined: Mon Sep 25, 2017 3:19 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 1 guest