function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shaanRocksshaanRocks 

Partner User

Hi,

I have a requirement in which i need to update a field on partner portal user whenever he logs in.

To be more clear:

I have a field in contact (say cntct1) and i need to populate the field on user object( say usr1) with the contacts field(cntct1) when ever a user log in as a partner.

 

please provide me with solution if any.

 

Any help is appreciated.

 

Thanks

shaan

Bhawani SharmaBhawani Sharma

You need to make the changes in the LoginController class.

After the login api called , you can do somehing like following :

 

User usr = [Select Id, usr1, ContactId, Contact.cntct1  from User where id =: UserInfo.getUserId()];

 

if(usr.usr1 != Contact.cntct1)

{

upsert new Contact(Id = Contact.Id, cntct1 = usr.usr1);

}

shaanRocksshaanRocks

Thanks for your reply.

 

Where can i find the LoginController class.  Is it a custom Apex class.

Please let me know where should i write the code and where can i find the LoginController class and how this class is invoked when logged in.

 

 

Bhawani SharmaBhawani Sharma

This is a standard class . It created once you enable the site in the organization.

 

shaanRocksshaanRocks

Hey again thanks for quick reply.

i dont have site enabled in my sndbox....  we dont have rights to enable it...

So what can be done now.. is there any soln?

Bhawani SharmaBhawani Sharma

Then how you are allowing the Partner user to login in to the application?

shaanRocksshaanRocks

In our application we have enabled partner portal.

We have enabled the contacts as partner users under particular account.

whenever a partner wants to login he has his credentials and he will log in as a partner.

For that is there any necessity of enabling sites?

Bhawani SharmaBhawani Sharma

You have the partner user credentials with you.

 

Now my question is from which page he goes for login ?

 

can you send me the URL for that ?

BA_AdminBA_Admin

Shaan,

      If a partner user wants to login to portal then he needs a link to login, basically i was working on this and when you enable the partner portal you get a login URL and in the email template which gets created automatically when you enable the partner portal you have to include this login URL in the template so whenever u create a partner user an email goes to the person containing username and password and login link, i guess you are enabling the partner portal for users who are already in the salesforce but in real time they login through portal through a login link