Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to set userCustom fields in server script

Avatar

Former Community Member

Does anyone know if it is possible to create UserCustomFields using a server script api call?  I basically want to emulate what the room console does with added CustomFields except I dont know the method to call on the server.  I am adding functionality to the java server script provided in the sdk download. 

Thanks for any help.

-chris

5 Replies

Avatar

Former Community Member

Hi Chris,

The recommended approach is to add the custom fields, then commit the room in question as a Template (you can find this in the room console). From then on, when it's time to create a new room, your server can create one based on that template, and it will come pre-equipped with the fields you saved.

does that help? Once we're done with an ecommerce release (gee, I wonder when that will happen... ;0) the next feature we're going to work on is server-to-server APIs which will allow you to do what you're asking at runtime.

nigel

Avatar

Former Community Member

Nigel,

Thanks for the reply.  I am trying to make my application a little easier for others to setup once it is given out.  I wanted to have a little java app (following the example of the command line java example) that will setup the room names correctly and set the custom fields. 

In my actual flex application I do have the owner register the custom fields but if someone that is not the owner logs in first then the custom fields are never registered b/c someone that is not an owner cant create custom fields.

I can just make instructions for the user to setup the room names correctly and then login the first time as the owner so the fields get set.

Cant wait to see that server API though

-chris

Avatar

Former Community Member

Can't help but notice the word "template" is missing in your reply - any reason you can't use them for this project? =)

nigel

Avatar

Former Community Member

Got me on that one.  I didn't mention templates because it doesn't seem like there is a way to export a template from my afcs account into something (ie xml) and then import it into another afcs account.  I guess I should have asked if that was possible before assuming I could not export a template

I am trying to make it as easy as possible for a user to run my sample application on their own afcs account. 

-chris

Avatar

Former Community Member

Not sure why I didnt think of this earlier but I simply have the clients listen for custom field register and then continue on processing.