You need to sign in to do that
Don't have an account?
Chrissy Thompson 12
Resource Code to Pull Related Contacts
How would you write an apex controller for a visual forec page (communities) to reference a field, which holds a concatenation of all account id's the user has access to and the apex controller code for the VF page used this field's content when retrieving records.
This below does not work, but I don't know how to code so I am not surprised. Any thoughts?
public class NapiliCommunityController {
@AuraEnabled
public static User getLoggedInUser(){
return [SELECT Id, Contact.AccountIds__c FROM User WHERE Id =: UserInfo.getUserId() LIMIT 1];
}
}
This below does not work, but I don't know how to code so I am not surprised. Any thoughts?
public class NapiliCommunityController {
@AuraEnabled
public static User getLoggedInUser(){
return [SELECT Id, Contact.AccountIds__c FROM User WHERE Id =: UserInfo.getUserId() LIMIT 1];
}
}
({ redirectToAccount: function(component, event, helper) { var loggedInUser; var state; var navEvt; var action = component.get("c.getLoggedInUser"); action.setCallback(this, function(response) { state = response.getState(); if (state === "SUCCESS") { loggedInUser = response.getReturnValue(); navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": loggedInUser.Contact.AccountId, "slideDevName": "detail" }); navEvt.fire(); } }); $A.enqueueAction(action); } })