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

How the Partner user is login into the application ?

 

Da you have site enabled?

shaanRocksshaanRocks

No the Site is not anabled.