0

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

or display a user profile pic on a custom object

1 Answer 1

0

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;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .