You need to sign in to do that
Don't have an account?
Merging a custom obj with the contacts
Hi "clouders"; i'll gladly thank everyone who'll have the time to get me out from this riddle.
I'ld like to copy the user.communitynickname into a custom nickname__c.
Will explain it a lil better :
I've a custom object named xxx__c that has a field called nickname__c.
I'ld like to parse the id of the user, already insered via autheticathed customer portal, and set it as my nickname__c.
Have used an extension to the standardcontroller to make a custom pagereference and to save the xxx__c fields he needs to fill but can't manage to have the " Id id = System.currentPageReference().getParameters().get('id'); " set as nickname__c .
Ty in advance !
Hi llmate,
If you don't mind,can you please paste the controller & the VF you have used, that way it will be easier to tel the solution.
Regards,
joshisrik@gmail.com
I used the standard implementation for the authentication system and it storages this infos :
Username, Nickname, email and password
I'ld like to take the username or the nickname or the id from the contact where the authenticated user is saved and copy it to my custom Utente__c
That's the actual controller ext:
public class myControllerExtension {
private final Utente__c utente;
public myControllerExtension(ApexPages.StandardController stdController) {
utente = (utente__c)stdController.getRecord();
}
public PageReference salva() {
try {
insert(utente);
}
catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
PageReference p = Page.scelta;
p.setRedirect(true);
return p;
}
}
The vf page is just a form to be filled with the values i want in my custom obj. Utente__c
exa : <apex:inputField value="{!Utente__c.Numero__c}"/>
The logic i tried to shape, without implementing it, is :
Id id = System.currentPageReference().getParameters().get('id');
id= utente__c.nickname__c
Thank you in advance sir.
who inserts the custom utente record?
If the Users are themselves entering, then you can get User information through standard 'Userinfo' method.
public class myControllerExtension {
private final Utente__c utente;
public myControllerExtension(ApexPages.StandardController stdController) {
utente = (utente__c)stdController.getRecord();
}
public PageReference salva() {
try {
utente.nickname__c=Userinfo.getUserId();// Here you will get the ID of the User logged in.
insert(utente);
}
catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
PageReference p = Page.scelta;
p.setRedirect(true);
return p;
}
}
If you want any other User info, please go through,
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
Should you have any questions,please go haead.
Regards,
joshisrik@gmail.com