Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Extending User Properties with multifield xtype is not saving

Avatar

Avatar
Validate 1
Level 2
kradhakrishna
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kradhakrishna
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kradhakrishna
Level 2

04-05-2016

Hi All,

I am trying to Extend User properties, I have created a client lib, like the below

CQ.Ext.ns("CustomUserProperties"); CustomUserProperties.UserAdmin = { addCustomUserProperties: function(propPanel){ var userForm = propPanel.userForm; userForm.setAutoScroll(true); var locations = { "xtype":"multifield", "fieldLabel": "Locations", "anchor":"100%", "name":"locations" }; userForm.insert(userForm.items.length + 1, locations); userForm.doLayout(); } }; (function(){ if(window.location.pathname == "/useradmin"){ var fields = CQ.security.data.AuthRecord.FIELDS; fields.push({"name": "locations"}); var UA_INTERVAL = setInterval(function(){ var userAdmin = CQ.Ext.getCmp("cq-useradmin"); if(userAdmin && userAdmin.userProperties){ clearInterval(UA_INTERVAL); CustomUserProperties.UserAdmin.addCustomUserProperties(userAdmin.userProperties); } }, 250); } })();

I can able to see multifield and can able to add locations but when I save it its not saving complete array to /home/users, just saving only one row of the locations field value.

How can I setup/configure to save multifield variables?

Is there any alternative way to use multifield xtype ? 

 

 

Thank you,

Krishna

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,161 likes

Total Posts

6,265 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,161 likes

Total Posts

6,265 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

05-05-2016

Hi 

Look at this community article:-

Link:- http://experience-aem.blogspot.ch/2014/01/aem-cq-56-extend-useradmin-add-new-user.html

//AEM - Extend UserAdmin, add new User Properties

Here two solutions are provided, first one is preferred.

Solution - 1


1) Create a cq:ClientLibraryFolder /apps/myclientlib and add property categories cq.security of type String

2) Create /apps/myclientlib/js.txt of type nt:file and add the following

                  UserProperties.js

3) Create /apps/myclientlib/UserProperties.js of type nt:file and add the following code

CQ.Ext.ns("MyClientLib");
 
MyClientLib.UserAdmin = {
    addSecondEmail: function(propPanel){
        var userForm = propPanel.userForm;
        var emailComp = userForm.find('name', 'email');
 
        var secondEmailComp = {
            "xtype":"textfield",
            "fieldLabel": "Second Email",
            "anchor":"100%",
            "name":"secondEmail"
        };
 
        userForm.insert(userForm.items.indexOf(emailComp[0]) + 1, secondEmailComp);
        userForm.doLayout();
    }
};
 
(function(){
    if(window.location.pathname == "/useradmin"){
        var fields = CQ.security.data.AuthRecord.FIELDS;
        fields.push({"name": "secondEmail"});
 
        var UA_INTERVAL = setInterval(function(){
            var userAdmin = CQ.Ext.getCmp("cq-useradmin");
 
            if(userAdmin && userAdmin.userProperties){
                clearInterval(UA_INTERVAL);
                MyClientLib.UserAdmin.addSecondEmail(userAdmin.userProperties);
            }
        }, 250);
    }
})();

Another reference article:- http://experience-aem.blogspot.com/2014/01/aem-cq-56-extend-useradmin-add-new-user.html?showComment=...

I hope this would be helpful to you.

Thanks and Regards

Kautuk Sahni

Avatar

Avatar
Validate 1
Level 2
kradhakrishna
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kradhakrishna
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kradhakrishna
Level 2

05-05-2016

@Kautuk,

Yes I took it from the web, but my question is

How can I setup/configure to save multifield variables?

Is that possible are not?

Regards,

Krishna

Avatar

Avatar
Validate 1
Level 5
Tuhin_Ghosh
Level 5

Likes

36 likes

Total Posts

301 posts

Correct Reply

40 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 5
Tuhin_Ghosh
Level 5

Likes

36 likes

Total Posts

301 posts

Correct Reply

40 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
Tuhin_Ghosh
Level 5

06-05-2016

Yes Krishna,

You can save multifield variables. have you tried Kautuk's approach?

Thanks

Tuhin