• Dan Napolitano
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
So I am trying to create a picklist of contact names from a specific account (listing available installers) to be assigned as a specific field selection in other accounts. Over time, of course, installer contacts will be added and removed, but it will always be one specific account hosting the contacts.

I thought I would create an Apex trigger to compile that list, but I'm in a bit over my head. Here's what I have so far:
 
trigger Installers on Contact (after update, after insert) 
    {    
       String names='';
       Integer ok=1;
       Set<id> accIdList =  '001G0000022epuD';
       for(Contact con : Trigger.new)
       {
          if(con.accountid!=null)
           accIdList.add(con.accountid);
       }

       List<Account> accUpdateList = new List<Account>();
       for(Account acc : [Select id, name, Contact_Name__c, (Select Id, name From Contacts) From Account Where Id In : accIdList])
       {
           ok=1;
           for(Contact con : acc.contacts)
           {    

              if(con.name!=null)
              {
               if(ok==1)
               {
                names = con.name;
                ok=0; 
               }

               else
                {
                names = names  + ',' + con.name;
                }

             }

           }
         acc.Contact_Name__c = names;
         accUpdateList.add(acc);
       }    
       update accUpdateList;
}

I'm receiving an error: Illegal assignment from String to Set<Id>. Perhaps somebody can help me over the hump here?

Thanks. 
I am trying to redirect portal partner users to individualized list views on a custom VisualForce Accounts tab, based upon each user's portal role or profile (I've aligned the roles with the profiles). 

My custom VF page (named AA_Accounts_View) is this:
 
<apex:page readonly="true" tabStyle="Account">
    <apex:sectionHeader title="{!$objectType.Account.LabelPlural}" subtitle="My Sites"/>
    <apex:ListViews type="Account" />
    <style type="text/css">
    .actionColumn {display:none; visibility:hidden}
    </style>
    <apex:panelGrid columns="2" width="100%">
    </apex:panelGrid>
</apex:page>

I have been attempting to create a custom home page component, using either a VF page or an HTML area, to redirect each profile to its specific list view. Here is one of the custom HTML home page components I tried:
 
<script>
(document.getElementsByTagName('h2')[0])
.parentNode
.parentNode
.style.display = 'none';
if(window.location.pathname=='001/o')
location.replace('001?fcf=00BG0000009N1JS');
</script>

Here is a VF page I wrote to use as a home page component:
 
<apex:page readonly="true" tabStyle="Account">
    <apex:sectionHeader title="{!$objectType.Account.LabelPlural}" subtitle="My Sites"/>
    <apex:ListViews type="Account" />
    <style type="text/css">
    .actionColumn {display:none; visibility:hidden}
    </style>
    <apex:panelGrid columns="2" width="100%">
    </apex:panelGrid>
 <script type="text/javascript">
      parent.frames.location.replace("001?fcf=00BG0000009N1JS");                                          
 </script> 
</apex:page>

By the way, our portal URL manifests in the portal as:

https://ourcompany.force.com/portal/apex/AA_Accounts_View

I have set the VF page to the default landing page in the portal. Previously, the landing page showed as https://ourcompany.force.com/portal/001/o, but the redirects did not seem to work in that case, either.

I have been adding each home page component to its profile-based home page as a narrow component (Settings > Customize > Home > Home Page Layouts > Edit).

What I expected to happen using either of the home page components above is for the default home page to load and show the list view having the ID 00BG0000009N1JS, not recently viewed accounts. But Recently Viewed just keeps loading.

If anybody can help me understand what I am doing incorrectly, thanks very much.
I want to upload the multiple files in the vf page & inserted in the document object. Please help me out buddies.
  • September 24, 2015
  • Like
  • 0

Iam trying to count the number of contacts on account, Iam getting the following error message

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<Account> at line 10 column 1    

Trigger counting on contact(after update,after insert){
Set<account> accids=New Set<Account>();
For(contact c:trigger.new){
Accids.add(c.Account);
}
List<Contact> con = [select id  from contact where AccountID IN:accids];
List<Account> Acc=[Select count__C from account where id IN:accids ];
For(contact c:trigger.new)
{
Acc.count__c=con.size();
}
}