You need to sign in to do that
Don't have an account?
Hermann Ouré
Add Set Ids to a String Variable
Hello,
I am trying to use the Ids that I store in a Set; in a String variable but I am unable to do so.
I have obviously an error: Variable Id does not exist. But I don't j=know how to fix it.
Could someone help?
Thanks
here is what I wrote:
I am trying to use the Ids that I store in a Set; in a String variable but I am unable to do so.
I have obviously an error: Variable Id does not exist. But I don't j=know how to fix it.
Could someone help?
Thanks
here is what I wrote:
public static String setSlackUserNickName(String businessUnit) { String channelName; Set<ID> headOfService_ids = new Set<ID>(); Map<Id, Application_Parameters__c> headOfService = New Map<Id, Application_Parameters__c>( [SELECT Id, Head_of_Service__c FROM Application_Parameters__c WHERE Business_Unit__c = :businessUnit]); for(Application_Parameters__c app : headOfService.values()) { headOfService_ids.add(app.Head_of_Service__c); } channelName = ''+headOfService_ids.get(Id).CommunityNickname+'';
I am suspecting the issue is occurring at the following line
channelName = ''+headOfService_ids.get(Id).CommunityNickname+'';
Try passing a dynamic value instead of id because id is not defined as a variable anywhere in your class
like headOfService_ids.get(app.Head_of_Service__c)
I recommend adding a system.debug to your code and see what values are being retrieved
Let me know if this helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!
Anudeep