• orawan_CMPD
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies

I am wondering if there is a clever way to avoid getting an error message when a query returns no results.  At the moment it throws a

 

List has no rows for assignment to SObject


This is my code:

 

public class CMPDProjectList {

    public List<CMPD_Projects__c> lstPro{get;set;}
    public List<CMPD_Projects__Share> lstProShare{get;set;}
    public List<Group> lstGroup{get;set;}
    
    public CMPDProjectList()
    {
        getGroup();
        getShare();  
        lstPro=getProlist();    
    }
    
    
     public void getGroup()
    {
        lstGroup = [Select    Group.Id,
Group.Type, Group.RelatedId From Group Where Group.RelatedId = :Userinfo.getUserRoleId() and Group.Type = 'Role']; } public void getShare() { for(Group g:lstGroup) { lstProShare = [ Select CMPD_Projects__Share.Id, CMPD_Projects__Share.ParentId, CMPD_Projects__Share.UserOrGroupId, CMPD_Projects__Share.RowCause From CMPD_Projects__Share Where CMPD_Projects__Share.UserOrGroupId = :g.Id or CMPD_Projects__Share.UserOrGroupId = :Userinfo.getUserId()]; } } public List<CMPD_Projects__c> getProlist() { CMPD_Projects__c objPro = new CMPD_Projects__c(); List<CMPD_Projects__c> lstPro = new List<CMPD_Projects__c>();
if(lstProShare.size() > 0) { for(CMPD_Projects__Share l:lstProShare) { objPro = [Select CMPD_Projects__c.Id, CMPD_Projects__c.Name, CMPD_Projects__c.Status__c, CMPD_Projects__c.Department__c, CMPD_Projects__c.Description__c, CMPD_Projects__c.OwnerId From CMPD_Projects__c Where CMPD_Projects__c.Id = : l.ParentId And CMPD_Projects__c.Status__c = 'In Progress']; lstPro.add(objPro); } } return lstPro; } }

 

Dear All,

I have user in service cloud user and right now I want to chang them to Chatter Plus and I got the Error 

Service Cloud User is not allowed for this License Type.

How I can do?

 

Thank for your kindness.

I just wondering, how we can add the field to My Task on homepage

I have custom picklist for percentage of progress and I want to add it on My Task at hompage.

 

please let me know , how I can do.


We try to setup site on sandbox and set permission for guest user to read only with account object then we created visual force page for this site. our site can see records 

with admin preview but for public site we can't to see records (http://cmpd.crp1.cs6.force.com/Property) we already set permission for object and fields also.

what would we need to do anymore?

 

My Site :

 

Guest Profile :

 

Object Setting :

 

Field Setting :

 

Preview with admin :

 

Direct to Plubic Site :


 

I have a event and invited some one in my company My event have and attachment but her can't to view.
And I get error message

" Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. "


how I can do?


:smileysad:

I am wondering if there is a clever way to avoid getting an error message when a query returns no results.  At the moment it throws a

 

List has no rows for assignment to SObject


This is my code:

 

public class CMPDProjectList {

    public List<CMPD_Projects__c> lstPro{get;set;}
    public List<CMPD_Projects__Share> lstProShare{get;set;}
    public List<Group> lstGroup{get;set;}
    
    public CMPDProjectList()
    {
        getGroup();
        getShare();  
        lstPro=getProlist();    
    }
    
    
     public void getGroup()
    {
        lstGroup = [Select    Group.Id,
Group.Type, Group.RelatedId From Group Where Group.RelatedId = :Userinfo.getUserRoleId() and Group.Type = 'Role']; } public void getShare() { for(Group g:lstGroup) { lstProShare = [ Select CMPD_Projects__Share.Id, CMPD_Projects__Share.ParentId, CMPD_Projects__Share.UserOrGroupId, CMPD_Projects__Share.RowCause From CMPD_Projects__Share Where CMPD_Projects__Share.UserOrGroupId = :g.Id or CMPD_Projects__Share.UserOrGroupId = :Userinfo.getUserId()]; } } public List<CMPD_Projects__c> getProlist() { CMPD_Projects__c objPro = new CMPD_Projects__c(); List<CMPD_Projects__c> lstPro = new List<CMPD_Projects__c>();
if(lstProShare.size() > 0) { for(CMPD_Projects__Share l:lstProShare) { objPro = [Select CMPD_Projects__c.Id, CMPD_Projects__c.Name, CMPD_Projects__c.Status__c, CMPD_Projects__c.Department__c, CMPD_Projects__c.Description__c, CMPD_Projects__c.OwnerId From CMPD_Projects__c Where CMPD_Projects__c.Id = : l.ParentId And CMPD_Projects__c.Status__c = 'In Progress']; lstPro.add(objPro); } } return lstPro; } }

 

I have a event and invited some one in my company My event have and attachment but her can't to view.
And I get error message

" Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. "


how I can do?


:smileysad:

I have a unique situation.  We have essentially three business lines that are competing against each other in some aspects of each business.  Because of this competition we want to limit who can follow who so that they are not able to read what is going on in each business.  I would appreciate any help in coming up with a way to automate this process.  Rather than having to set a corporate policy that will be difficult to enforce.  I saw the app on the app exchange but unfortunately it does not allow to unfollow people based on roles.  Thank you.

 

Bladen