anyone know how to Create a field to save the 'FullPhotoURL' of a user?

or display a user profile pic on a custom object


Create a field on the custom object of type URL, e.g. MyObject__c.UserPhotoUrl__c

Retrieve the FullPhotoURL of the user (in this example, the current user):

User currentUser = [SELECT FullPhotoUrl FROM user WHERE Id = :UserInfo.getUserId() LIMIT 1];

Save a custom object record with the user's FullPhotoUrl:

MyObject__c myObject = new MyObject__c();
myObject.UserPhotoUrl__c = currentUser.FullPhotoUrl;
insert myObject;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.