• SlashApex (Luis Luciani)
  • NEWBIE
  • 355 Points
  • Member since 2014
  • Salesforce Development Manager
  • Ultimate Software


  • Chatter
    Feed
  • 11
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 73
    Replies
Hi,

I am working on some custom Controller and VF pages, but the page is throwing error that 

System.NullPointerException: Attempt to de-reference a null object 
Class.ControllerApexsharing.<init>: line 7, column 1

My Class and VF pages are below.
Class---
public class ControllerApexsharing{
 
   public List<ApexSharing__c> SelectedApexSharing{ get; set; }
          public ControllerApexsharing(){
           for(ApexSharing__c Apexs :[select id,name, Field_1__c,Field_2__c,Account__c from ApexSharing__c]){
                system.debug('***' + Apexs.name +'***');
            SelectedApexSharing.add( Apexs);
            }
     }

}
VF page---
<apex:page controller="ControllerApexsharing">
  <apex:form >
      <apex:pageBlock >
           
            <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!SelectedApexSharing}" var="LoopVar">
                    <apex:column value="{!LoopVar.id}"/>
                    <apex:column value="{!LoopVar.name}"/>
                    <apex:column value="{!LoopVar.Field_1__c}"/>
                    <apex:column value="{!LoopVar.Field_2__c}"/>
                    <apex:column value="{!LoopVar.Account__c }"/>

                </apex:pageBlockTable>
            </apex:pageBlockSection>
      </apex:pageBlock>
    </apex:form>
 </apex:page>

Please suggest...

 
I am trying to create a trigger that calls a class to update a Task.  

My Class is:
public class TriggerHandlerTask {
    
    public TriggerHandlerTask(){}
    public void UpdateTaskType(Task[] newTasks){
    
     for (Task t1 : NewTasks){    
            /* 
            Developer     : Todd Barry
            Created       : 
            Last Modified : 05/18/2015
            Test Class    : 
            Objective     : When a PSS or COS BCC's to salesforce, this will ensure the correct Activity Type is set
            */
// Only update the task type if a type value has not already been selected 
If (t1.type==null){
        if(t1.subject.contains('email') || t1.subject.contains('Email')){
        t1.type='Email';}
          
    if(t1.subject.contains('meet') || t1.subject.contains('Meet')){
        t1.type='Meeting';  }
        
        else if(t1.subject.contains('visit')|| t1.subject.contains('Visit'))
        t1.type='Office Visit';   
        
        if(t1.subject.contains('call') || t1.subject.contains('Call'))
        t1.type='Phone Call';
        
        else if(t1.subject!= null)
        t1.type='Other';
}

// This update is for emails BCC to salesforce.
if(t1.subject.contains('email:') || t1.subject.contains('Email:')){
        t1.Activity_type_01__c='Email';}
        
}
                   
    }}

And my Trigger is:
trigger UpdateTaskType on Task (before insert, before Update) {

If(Trigger.isBefore){
    if(Trigger.isInsert){
        TriggerHandlerTask Handler = TriggerHandlerTask();
        Handler.UpdateTaskType(Trigger.new);
    }
    If(Trigger.isUpdate){
    }
}    
Else If(Trigger.isAfter){
    if(Trigger.isInsert){
    }
    If(Trigger.isUpdate){
    }
}
}
But i keep getting this error:  Error: Compile Error: Method does not exist or incorrect signature: TriggerHandlerTask() at line 6 column 38

What am I missing?
Is it possible to track user wise page access using google analytics. 
for example we need to track which users accessed how many times  in a given period to a specific page.
 
  • April 17, 2015
  • Like
  • 0
this is my code:
  String myPlainText= 'CompanyName: Heodo Order Number: 2000157 Date Ordered: Wednesday, May 21, 2014 City: Auckland, 2241 State/Province: North Island, New Zealand Phone: 021735562';
  
      Pattern p=Pattern.compile('Order Number: ([\\d]{7})'); 

      Matcher m = p.matcher(myPlainText);
      if(m.matches())
      {
        system.debug(m.group(1));          
      }      
      
Decimal Ordernum = Decimal.valueOf(m.group(1));
      OrderRecord__c record = new OrderRecord__c(CustomerEmail__c = email.fromAddress, CustomerName__c='NINI',
        OrderNumber__c =Ordernum);

 insert record;  

my qusetion is:
i wanna get a value which is 2000157 from m.group(1). but i can't.
i don't know where have problems in my code, could you tell me and give me a right answer?
i am so appriciate!!
  • April 17, 2015
  • Like
  • 0
Our business model works on referrals, and I want to be able to link a Contact or Lead to the Contact who referred them to us.

Eg. Ben refers Tom

We create a new lead for Tom to be followed up. This lead has a look-upfield, "Referred by" which links to Ben
Ben's contact also has a field "Referral # (i.e. there would be around 3 fields with the same function)" which links to Tom's lead

Is this possible?
Hi Guys,

I want to throw an error message when FROM address is not "Email@sample.com" ONLY for a particular record type.

I have written the below code, but for some reason, it evaluates for all the record types.

trigger Validate_OnEmail on EmailMessage (before insert, before update) {
    
    List<Case> cs = [SELECT RecordTypeId FROM Case WHERE RecordTypeId = '000XXX000'];
    
    for (Case cs1:cs)
{
       for (EmailMessage newEmail:trigger.new)
{

    if( newEmail.Incoming!=true && (newEmail.FromAddress!='Email@sample.com'))
 
        newEmail.addError('From:Email Address should be "Email@sample.com"');
}
    }
}
Returns no errors, but triggers for case replies of all record types.

Appreciate your help!!!
I'd like to expose some customer data to customers but do not have the budget to purchase customer community
I want customers to be able to log into what looks like our website and see some info from records of custom objects and standard objects such as Account, Contact, Quote and Asset.
Is it possible to get around this using sites and coding?
How much work is involved
thanks
Jane
Is there a way to combine some of these cases to shorten the formula? I need to keep adding options, but the formula field has reached the character limit.
IF(ISBLANK(Member_Code__c), 
((CASE(TEXT(Annual_Revenue__c), "Up to $100k", 155, "$100k to $1m", 300, "$1m to $5m", 430, "$5m to $10m", 765, "$10m to $20m", 990, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 85, "2", 170, "3", 255, "4", 340, "5", 425, 0))), 

(CASE(Member_Code__c, 

"bmac2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"exce2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"amrs2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"restocan", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

/*Add new member codes above*/ 
((CASE(TEXT(Annual_Revenue__c), "Up to $100k", 155, "$100k to $1m", 300, "$1m to $5m", 430, "$5m to $10m", 765, "$10m to $20m", 990, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 85, "2", 170, "3", 255, "4", 340, "5", 425, 0))))))

Specifically, is there a way to combine  these conditions, because the output is the same for each conditions
 
(CASE(Member_Code__c, 

"bmac2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"exce2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"amrs2015", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)), 

"restocan", (CASE(TEXT(Annual_Revenue__c), "Up to $100k", 90, "$100k to $1m", 170, "$1m to $5m", 235, "$5m to $10m", 420, "$10m to $20m", 545, 0) 
+ 
CASE(TEXT(Number_of_Personal_Policies__c),"1", 65, "2", 130, "3", 195, "4", 260, "5", 325, 0)),
So, the complete formula would be:

If the field is blank, use the first set of numbers to calculate,
else if the field is bmac2015 or exce2015 or amrs2015 or restocan, use the second set of numbers to calculate,
if the field is full but is not one of those conditions, use the first set of numbers to calculate.

Is there a better way to approach this formula?

The use case is that when the person puts in one of the correct discount codes, the price is calculated accordingly. Right now, there is only one set of discounted pricing. There is the possibility in the future that there would be another set of discounted pricing, so the formula would look like: 

If the field is blank, use the first set of numbers to calculate,
else if the field is bmac2015 or exce2015 or amrs2015 or restocan, use the second set of numbers to calculate,
else if the field is *some other conditions*, use a third set of numbers to calculate
if the field is full but is not one of those conditions, use the first set of numbers to calculate.

I hope someone can point me in the right direction with this. I appreciate any help.

Thanks!
Hi,

    I'm now building a new opportunity view page to override the standard one, and the inline editing is working - we can edit on the output fields and also a pencil icon show up when mouse hover on the field is editable.

    My question is If anyone knows how to display the lock icon for non-editable fields when mouse hover on ? 


Thanks
I created a visual force page with Account Details at the top and a contact related list at the bottom.  I have Save and Cancel buttons on the page.  The Save button works after I modify a contact but does not save the modification when I change one of the account fields.  Here is my code.

---VF Page---
<apex:page standardController="Account" showHeader="true" sidebar="true" extensions="EditableContactListExtension">
    <apex:form >  
      <apex:pageMessages id="messages"/>
        <apex:pageBlock title="Account Penetration" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
                <apex:commandButton value="Print Profile" action="{!URLFOR($Action.Account.View,Account.Id)}" onclick="openConga()"/>
                <Script Language="JavaScript">function openConga() { window.open('{!URLFOR($Action.Account.Penetration_Profile,Account.Id)}', '','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes, toolbar=no,location=no,status=yes'); }  
                </Script>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Contact Penetration" columns="3">
                <apex:outputField value="{!account.Architect_Contacts__c}"/>
                <apex:outputField value="{!account.Design_Contacts__c}"/>
                <apex:outputField value="{!account.Total_Contacts__c}"/>
                <apex:outputField value="{!account.Architects_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Designers_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Total_Engaged_6_Months__c}"/>
                <apex:outputField value="{!account.Architect_Penetration__c}"/>
                <apex:outputField value="{!account.Design_Penetration__c}"/>
                <apex:outputField value="{!account.Total_Penetration__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Specification Share of Wallet" columns="2">
                <apex:inputField value="{!account.Total_Annual_Specifications_Number__c}"/>
                <apex:inputField value="{!account.Total_Annual_Specifications_Sales__c}"/>
                <apex:inputField value="{!account.Koroseal_Specs_TTM_Number__c}"/>
                <apex:inputField value="{!account.Koroseal_Specs_TTM_Sales__c}"/>
                <apex:outputField value="{!account.Share_of_Wallet_Number__c}"/>
                <apex:outputField value="{!account.Share_of_Wallet_Sales__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Specification Win Rate" columns="1">
                <apex:outputField value="{!account.Koroseal_Specs_TTM__c}"/>
                <apex:inputField value="{!account.Specifications_Won__c}"/>
                <apex:inputField value="{!account.Specifications_Lost__c}"/>
                <apex:outputField value="{!account.Specification_Win_Rate__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection id="childList" columns="1" title="Known Contacts" collapsible="false">
        	  <!-- There is a trick to creating a counter when rendering rows in a
              pageBlockTable. You have to define a variable to default to 0,
              and then update that variable inside the table row. This is the
              way that I can leverage smart row deletes -->
        <apex:variable var="rowNum" value="{!ZERO}" />
        <apex:outputLabel value="No Contacts currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
        <apex:pageBlockTable value="{!children}" var="contact" rendered="{!hasChildren}" >
          <apex:column headerValue="First Name">
            <apex:inputField value="{!contact.FirstName}" />
          </apex:column>
          <apex:column headerValue="Last Name">
            <apex:inputField value="{!contact.LastName}" />
          </apex:column>
            <!-- Add additional children metadata columns here -->
          <apex:column headerValue="Studio">
            <apex:inputField value="{!contact.Studio__c}" />
          </apex:column>
          <apex:column headerValue="Type">
            <apex:inputField value="{!contact.Type__c}" />
          </apex:column>
          <apex:column headerValue="Preferred Contact Frequency">
            <apex:inputField value="{!contact.Preferred_Contact_Frequency__c}" />
          </apex:column>
          <apex:column headerValue="Date Last Contacted">
            <apex:inputField value="{!contact.Date_Last_Contacted__c}" />
          </apex:column>
          <apex:column headerValue="Days Since Contact">
            <apex:inputField value="{!contact.Days_Since_Contact__c}" />
          </apex:column>  
            <!-- This is the second half of the trick to keep track
                  of your row index for deletion. -->
            <apex:variable var="rowNum" value="{!rowNum + 1}" />
            <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList, messages" immediate="true">
              <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
        </apex:pageBlockTable>
        <!-- Want to specify immediate here and above so validation does
              not occur when you are trying to add/remove rows. Only want
              validation to occur when trying to save -->
        <apex:commandButton value="Add Contact" action="{!addToList}" rerender="childList, messages" immediate="true" />
      	</apex:pageBlockSection>
      </apex:pageBlock>
    </apex:form>
</apex:page>
Thanks!
The use case would be if a support agent has ten open tickets, the criteria for "hot" case would differentiate that tab with a color or some other type of indicator. 

I've thought about creating a Tab through VF and populating that page with appropriate case, but it would have to be selected in the drop down rather than a case amongst other cases in the primary tab section. 

Any sniff in the right direction would be helpful and I'll share the completed project once it's done. 

 
Apply HERE : http://bit.ly/1Kbd4ZK

Ultimate Software is seeking a Salesforce.com Developer to join our fast-paced, enterprise-wide Division. Our team provides leadership and organization for key operational and strategic business projects, which typically cross multiple divisions within the company. This individual will manage a wide variety of aspects in our Salesforce.com instance. The ideal candidate must be a self-starter, comfortable in a fast pace environment, while understanding a variety of corporate systems and their interactions. Must be able to perform a wide range of responsibilities (from daily administration to higher-level strategy) and be comfortable working with a variety of cross-functional teams. We are looking for an individual who thrives in an environment that is both collaborative and complex and who is motivated to build relationships and get things done.   Attention to detail is crucial, but the ability to be flexible, think quickly on your feet, and an ability and interest in understanding dependencies and the “big picture” is also important. 

This is your opportunity to apply and expand upon your current level of Salesforce.com knowledge! Our company leverages Salesforce.com to support critical and complex business processes (internal and customer-facing). We are growing our team to support ongoing expansion into new functionality. Come join us for this exciting adventure!  

Ultimate is ranked #21 in FORTUNE's 100 “Best Places to Work For in 2015.” This is the fourth year in a row we have been listed on FORTUNE’s list. We were ranked #20 in 2014 and #9 in 2013. Ultimate is also ranked #4 on the inaugural list of “Ten Great Workplaces for Millennials” produced by Great Place to Work®’s Great Rated!™

Primary Responsibilities:

Spend 80% of your time working in a hands-on way on day-to-day tasks and 20% of your time working on Salesforce related projects and tasks requiring high degree of technical expertise
Have domain expertise in at least two area that is critical to the business
Work independently with minimal supervision
Participate in design sessions for the creation of functional & business requirements and design
Participate in Salesforce related architectural and solution discussions
Have some understanding of our application infrastructure; troubleshoot issues and engage the appropriate engineering teams as issues arise that fall out of our domain
Work closely with the Architect and Lead Developer to vet out design and other critical application decisions
Seek to expand your knowledge of Salesforce, Apex, Visualforce, related tools, technologies and best-practices
Analyze, recommend, and implement Salesforce tools
Active analysis of existing internal/external design, architecture and development practices in their domain to ensure continuous improvement of internal org/systems
Engage in conversations with internal users to understand their line of business
Keep alert of integrated product developments that translate to environmental or code modifications
Rely on instructions, pre-established guidelines, policies, and procedures to perform day to day tasks
Rely on research and domain expertise to work on technical projects
Keep projects, initiatives in motion and delivered on time for self and junior team members
Assist in developing project estimates and plans for self and junior team members
Assist in code review and deployment activities
Work closely with QA, Business Analysts, BI/Report Designers, Database developers, Software Engineers and support staff throughout the full Software Development life cycle
Work closely with security and change management teams to ensure processes, procedures, and best practices all conform to audits that Ultimate Software is required to pass (ISO 27001, SAS70, and SOX compliance)

Requirements:

4+ years software development experience (C#, Visual Basic, Java, Salesforce, Apex, Visualforce, etc.)
2+ years Salesforce development experience
Experience with web development technologies (HTML, CSS, Javascript, AJAX, etc.)
Experience using Salesforce platform, tools and languages
Advanced understanding of the Software Development Life cycle preferred
Experience using ETL tools preferred
Experience with Salesforce Service Cloud preferred
Experience using MS Outlook, MS Excel, MS Word, MS Visio, MS PowerPoint
Experience integrating external systems with Salesforce
Experience with Salesforce Sales Cloud
Excellent analytical, problem-solving, and decision-making skills
Excellent written and verbal communication skills
Work effectively as a member of an agile team and/or independently
Ability to interact with other departments and business users who are not as technical in nature
Ability to understand system functionality, process, and architecture at a technical and business level
Moderately task-oriented
Ability to identify and prioritize technical system and application issues in a timely manner for self and others
Ability to lead educational discussions and presentations
High degree of self-motivation to learn new methodologies/technologies that will enhance job performance
Self-motivated and accountable to “do what it takes” to get the job done
Must be open to feedback of seniors when being mentored and in turn assist in the mentoring of other development staff members

Education/Certification/License:

Bachelor’s Degree in Computer Science or related discipline preferred
Salesforce DEV401 Certification
Salesforce ADM 201 Certification preferred

Travel Requirement: Limited travel upon request


Apply HERE : http://bit.ly/1Kbd4ZK
We are looking for a Salesforce Developer to join our team of amazing Salesforce engineers. We are an established Salesforce end user with a highly customized org and complete executive buy-in for the Salesforce platform. You will work on highly challenging projects on a day to day basis. This is a once in a lifetime opportunity.

Qualified Candidates will have the following skills and experience:
- 2+ Salesforce Experience
- Hands on APEX/Visualforce/SOQL 
- API's and basic Architectural skills preferred 
- Salesforce.com Certified Developer preferred
- Sales and Service Cloud project experience 
- Ability to turn technical requirements into Business Solutions

Location: Weston, FL.

The job posting is not online yet, but reach out to me via twitter (@luiseluciani) if you are interested, I am the hiring manager. Sorry no visa sponsorship, you must have a valid US work permit. 

Some of the benefits we offer:

100% Employer paid health coverage for employee and family (includes medical PPO plan, choice of dental plan, prescription and vision)
100% Employer paid health coverage for same sex married couples
100% Employer paid life insurance to match 1x annual salary
100% Employer paid long term disability
$10,000 spouse life insurance
Restricted Stock Units granted to every regular full-time employee
401k Retirement Savings Plan with 35% company match on every dollar of employee contribution
Paid Time Off starting with 15 days on 1st year of employment
Paid ‘UltiService’ Days (2 days per year/ per employee for charity work)
Online health, wellness and work-life balance service
Tuition/Certification Reimbursements
Paid Maternity/Paternity/Adoption Leave
Flexible Spending Accounts
Credit Union
One remote day per week

Read more about Ultimate Software here: http://www.ultimatesoftware.com/careers-at-ultimate

Check out the glassdoor reviews here: http://www.glassdoor.com/Overview/Working-at-Ultimate-Software-EI_IE7900.11,28.htm

You can reach me via twitter https://twitter.com/luiseluciani
We are looking for a Salesforce Developer to join our team of amazing Salesforce engineers. We are an established Salesforce end user with a highly customized org and complete executive buy-in for the Salesforce platform. You will work on highly challenging projects on a day to day basis. This is a once in a lifetime opportunity.

Qualified Candidates will have the following skills and experience:
- 2+ Salesforce Experience
- Hands on APEX/Visualforce/SOQL 
- API's and basic Architectural skills preferred 
- Salesforce.com Certified Developer preferred
- Sales and Service Cloud project experience 
- Ability to turn technical requirements into Business Solutions

Location: Weston, FL.

The job posting is not online yet, but reach out to me via twitter (@luiseluciani) if you are interested, I am the hiring manager. Sorry no visa sponsorship, you must have a valid US work permit. 

Some of the benefits we offer:

100% Employer paid health coverage for employee and family (includes medical PPO plan, choice of dental plan, prescription and vision)
100% Employer paid health coverage for same sex married couples
100% Employer paid life insurance to match 1x annual salary
100% Employer paid long term disability
$10,000 spouse life insurance
Restricted Stock Units granted to every regular full-time employee
401k Retirement Savings Plan with 35% company match on every dollar of employee contribution
Paid Time Off starting with 15 days on 1st year of employment
Paid ‘UltiService’ Days (2 days per year/ per employee for charity work)
Online health, wellness and work-life balance service
Tuition/Certification Reimbursements
Paid Maternity/Paternity/Adoption Leave
Flexible Spending Accounts
Credit Union
One remote day per week

Read more about Ultimate Software here: http://www.ultimatesoftware.com/careers-at-ultimate

Check out the glassdoor reviews here: http://www.glassdoor.com/Overview/Working-at-Ultimate-Software-EI_IE7900.11,28.htm

You can reach me via twitter https://twitter.com/luiseluciani
Hi,

I am working on some custom Controller and VF pages, but the page is throwing error that 

System.NullPointerException: Attempt to de-reference a null object 
Class.ControllerApexsharing.<init>: line 7, column 1

My Class and VF pages are below.
Class---
public class ControllerApexsharing{
 
   public List<ApexSharing__c> SelectedApexSharing{ get; set; }
          public ControllerApexsharing(){
           for(ApexSharing__c Apexs :[select id,name, Field_1__c,Field_2__c,Account__c from ApexSharing__c]){
                system.debug('***' + Apexs.name +'***');
            SelectedApexSharing.add( Apexs);
            }
     }

}
VF page---
<apex:page controller="ControllerApexsharing">
  <apex:form >
      <apex:pageBlock >
           
            <apex:pageBlockSection columns="1">
                <apex:pageBlockTable value="{!SelectedApexSharing}" var="LoopVar">
                    <apex:column value="{!LoopVar.id}"/>
                    <apex:column value="{!LoopVar.name}"/>
                    <apex:column value="{!LoopVar.Field_1__c}"/>
                    <apex:column value="{!LoopVar.Field_2__c}"/>
                    <apex:column value="{!LoopVar.Account__c }"/>

                </apex:pageBlockTable>
            </apex:pageBlockSection>
      </apex:pageBlock>
    </apex:form>
 </apex:page>

Please suggest...

 
Hi,

I need to run report on the email body field?
It is has few merge fields.

Please let me know if we can run reports on this field? How?

Thanks,
Babu.
  • May 19, 2015
  • Like
  • 0
I have a custom object.  I want to quickly review the permissions on this object for all of the profiles in my system.  Is this possible?  I can see how to go to every profile and then to Object Settings from there.  That gives me a quick overview of all of the objects for that profile.  What about an overview of all of the profiles for a given object.

Also, seeing this I decided to be very careful when creating new objects to assign them properly then.  But it appears that you're not given the option to set permissions at the time of creation for a new object.

Is this a recent change?  I don't remember it being this tedious to assign object permissions to many profiles.
Can one just put that object into read only for a given user so that the Edit and Del links should not be there?
What would be the best way to send an email alert to the CEO if three cases with the same lot # (a text field) are created in a 45 day period?  This is a moving target so, for instance, there could be 5 cases created but if 3 cases aren't created in the 45 day period, it should not fire.

Any suggestions?
I know this has got to be simple but I just can't figure it out after hacking away for an hour.  I am not experienced at this.

I'm simply trying to override the New button on a custom object to a URL which pre-populates the Name field.  The URL was easy to develop (below).  It works just like the standard New button but one field is populated with some text.  (We use a workflow rule to set the Name field so there's no need for the user to enter anything.)

  https://na18.salesforce.com/a0o/e?Name=[Set%20by%20Workflow%20Rule]&retURL=%2Fa0o%2Fo

When I want to change the default button it asks me for a VF page.  I have tried creating a simple VF page that just redirects to the URL above.  I'm a pretty novice VF developer and this simple task has got me struggling.

Thanks!!
Is there an api to access instance availability on the trust site?  I'm on NA 16 and would like to access availability info on http://trust.salesforce.com/trust/instances/NA16 instead of having to parse out html.  thanks!
I am trying to create a trigger that calls a class to update a Task.  

My Class is:
public class TriggerHandlerTask {
    
    public TriggerHandlerTask(){}
    public void UpdateTaskType(Task[] newTasks){
    
     for (Task t1 : NewTasks){    
            /* 
            Developer     : Todd Barry
            Created       : 
            Last Modified : 05/18/2015
            Test Class    : 
            Objective     : When a PSS or COS BCC's to salesforce, this will ensure the correct Activity Type is set
            */
// Only update the task type if a type value has not already been selected 
If (t1.type==null){
        if(t1.subject.contains('email') || t1.subject.contains('Email')){
        t1.type='Email';}
          
    if(t1.subject.contains('meet') || t1.subject.contains('Meet')){
        t1.type='Meeting';  }
        
        else if(t1.subject.contains('visit')|| t1.subject.contains('Visit'))
        t1.type='Office Visit';   
        
        if(t1.subject.contains('call') || t1.subject.contains('Call'))
        t1.type='Phone Call';
        
        else if(t1.subject!= null)
        t1.type='Other';
}

// This update is for emails BCC to salesforce.
if(t1.subject.contains('email:') || t1.subject.contains('Email:')){
        t1.Activity_type_01__c='Email';}
        
}
                   
    }}

And my Trigger is:
trigger UpdateTaskType on Task (before insert, before Update) {

If(Trigger.isBefore){
    if(Trigger.isInsert){
        TriggerHandlerTask Handler = TriggerHandlerTask();
        Handler.UpdateTaskType(Trigger.new);
    }
    If(Trigger.isUpdate){
    }
}    
Else If(Trigger.isAfter){
    if(Trigger.isInsert){
    }
    If(Trigger.isUpdate){
    }
}
}
But i keep getting this error:  Error: Compile Error: Method does not exist or incorrect signature: TriggerHandlerTask() at line 6 column 38

What am I missing?
I am working on a project to create a VF page where the user can add multiple attachments when creating a record.  I found some code online that allows me to do this, but it will return the following error "System.DmlException: Insert failed. First exception on row 1; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [File Name, Body]: [File Name, Body]" if a file isn't chosen for all 3 attachment selections.  Users may only need to attach 1 or 2 files to a record.  I need to find a way to determine if any of the selections are null and if they are to tell the system not to expect to see anything there.  My class and VF page are listed below:

APEX CLASS
public class AddMultipleAttachments {
    
    public Incident_Reports__c objIncidentReport { get; set; }
    public Attachment attachment1 { get; set; }
    public Attachment attachment2 { get; set; }
    public Attachment attachment3 { get; set; }

    public AddMultipleAttachments (ApexPages.StandardController stdController)
    {
        // Record and Attachments to be inserted
        objIncidentReport = new Incident_Reports__c();
        attachment1 = new Attachment();
        attachment2 = new Attachment();
        attachment3 = new Attachment();
    }

    public PageReference createRecordAndAttachments()
    {
        // Insert the record
        insert objIncidentReport;

        // Insert Attachments;
        attachment1.ParentId = objIncidentReport.Id;
        attachment2.ParentId = objIncidentReport.Id;
        attachment3.ParentId = objIncidentReport.Id;
        insert new List<Attachment> { attachment1, attachment2, attachment3 };

        // View the record
        PageReference page = ApexPages.currentPage();
        page.setRedirect(true);
        return page;
    }

}

VF Page
<apex:page standardController="Incident_Reports__c" extensions="AddMultipleAttachments">
    <apex:sectionHeader title="Property Incident Reports Edit" subtitle="{!Incident_Reports__c.Name}"/>
    <apex:form >
        
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Save with Attachments" action="{!createRecordAndAttachments}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>
        <apex:pageBlock title="Property Incident Reports Edit" mode="edit" id="thePageBlock">
          <apex:pagemessages />
            
            <apex:pageBlockSection columns="1">
              <apex:outputText value="ATTENTION:  Attorney work product/privileged document (for internal use only).  NOT for Associate Injuries, use Worker's Comp Incident Report." style="font-weight:800"/>
              <apex:outputText value="RED LINES REPRESENT REQUIRED FIELDS" style="color:red"  />
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Property Information" columns="2">
                <apex:inputField value="{!Incident_Reports__c.Property__c}" required="true"/>
                
            </apex:pageBlockSection>
               
            <apex:pageBlockSection title="Claimant Information" columns="2">
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Name__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Gender__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Address__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Age__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Phone_Number__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Phone_Number_Other__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Occupation__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Alliance_Associate__c}" required="false"/>
            </apex:pageBlockSection>  
                          
        </apex:pageBlock>
            
       
        
       <apex:pageBlock title="Incident Information" mode="edit" id="Incident">
            
          <apex:actionRegion >
            <apex:pageBlockSection title="Incident Type" columns="1">
              <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Type of Incident"/>
                    <apex:outputPanel >
                      <apex:inputField value="{!Incident_Reports__c.Type_of_Incident__c}" required="TRUE">
                        <apex:actionSupport event="onchange" rerender="Incident" status="IncidentType"/>
                      </apex:inputField>
                      <apex:actionStatus startText="applying value..." id="IncidentType"/>
                    </apex:outputPanel>
                  </apex:pageBlockSectionItem> 
            </apex:pageBlockSection>
          </apex:actionRegion>

          <apex:actionRegion >
            <apex:pageBlockSection title="Incident Information" columns="2">     
                <apex:inputField value="{!Incident_Reports__c.Date_Time_of_Incident__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Time_Incident_Reported__c}" required="false"/> 
                <apex:inputField value="{!Incident_Reports__c.Pictures_Attached__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Property_Owner_Notified__c}" required="false"/> 
                
                <apex:pageBlockSectionItem helpText="Check this box if Police, Fire or Ambulance were dispatched to the property.">
                    <apex:outputLabel value="Emergency Services Called"/>
                    <apex:outputPanel >
                      <apex:inputField value="{!Incident_Reports__c.Emergency_Services_Required__c}" label="Check if Police, Fire or Ambulance were dispatched to the property.">
                        <apex:actionSupport event="onclick" rerender="Incident" status="status"/>
                      </apex:inputField>
                      <apex:actionStatus startText="applying value..." id="status"/>
                    </apex:outputPanel>
                  </apex:pageBlockSectionItem>  
            </apex:pageBlockSection>
            
          </apex:actionRegion>
          
          <apex:actionRegion >
            <apex:pageBlockSection title="Responding Agencies" id="agencies" columns="2" rendered="{!Incident_Reports__c.Emergency_Services_Required__c == TRUE}">
              
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Police Department"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Police_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status1"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Police Department block..." id="status1"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Fire Department"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Fire_Department_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status2"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Fire Department block..." id="status2"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Ambulance Service"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status3"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Ambulance Service block..." id="status3"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Other Emergency Service"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Other_Department_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status4"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Other Emergency Service block..." id="status4"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
            </apex:pageBlockSection>
          </apex:actionRegion>
            
            <apex:pageBlockSection title="Police Department Information" id="police" columns="2" rendered="{!Incident_Reports__c.Police_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Police_Department_Name__c}" label="Police Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Police_Report_Number__c}" label="Police Report Number"/>
                
                                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Fire Department Information" columns="2" rendered="{!Incident_Reports__c.Fire_Department_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Fire_Department_Name__c}" label="Fire Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Fire_Dept_Report_Number__c}" label="Fire Dept. Report Number"/>
                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Ambulance Information" columns="2" rendered="{!Incident_Reports__c.Ambulance_Company_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Name__c}" label="Ambulance Company Name"/>
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Report_Number__c}" label="Ambulance Co. Report Number"/>
                
                <apex:inputField value="{!Incident_Reports__c.Hospital_Name__c}" label="Hospital Taken To (if applicable)"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Other Emergency Services" columns="2" rendered="{!Incident_Reports__c.Other_Department_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Other_Respondant__c}" label="Other Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Other_Report_Number__c}" label="Other Department Report Number"/>
                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Moisture / Flooding" columns="3" rendered="{!Incident_Reports__c.Type_of_Incident__c == 'Flood/Moisture'}" id="FloodingSection">
                <apex:inputTextarea value="{!Incident_Reports__c.Affected_Area__c}" label="Describe Affected Area" cols="40" rows="8"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Source_Cause_of_Moisture__c}" label="Describe Cause of Moisture" cols="40" rows="8"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Personal_Property_Damage__c}" label="Detail Damage to Personal Property" cols="40" rows="8"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Notification_Letter_Sent__c}" label="Date Notification Letter Sent"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Option_Letter_Given__c}" label="Date Option Letter Given"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Option_Letter_Received__c}" label="Date Option Letter Received"/>
                <apex:inputField value="{!Incident_Reports__c.Follow_Up_Call_Completed__c}" label="Date Follow-up Call Completed"/>
                <apex:inputField value="{!Incident_Reports__c.Follow_Up_Call_Associate__c}" label="Name of Associate Conducting Call"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Result_of_Conversation__c}" label="Result of Conversation" cols="40" rows="8"/>
            </apex:pageBlockSection>
           
        </apex:pageBlock>
           
        <apex:pageBlock title="Add Attachments">
          	<apex:pageBlockSection title="Attachment 1" >
                <apex:inputFile value="{!attachment1.body}" fileName="{!attachment1.name}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Attachment 2" >
                <apex:inputFile value="{!attachment2.body}" fileName="{!attachment2.name}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Attachment 3" >
                <apex:inputFile value="{!attachment3.body}" fileName="{!attachment3.name}"/>
            </apex:pageBlockSection>
        
        </apex:pageBlock>

           
        
        
    </apex:form>
    
    
     
</apex:page>
Any help will be greatly appreciated.

Thanks,
Matt
Hi guys,

i have a doubt:

with new release Summer 15 it's said to:
You can include JavaScript in your Visualforce page, but because the component is rendered in an iframe on the home page layout, the JavaScript can’t interact with the page that contains the component.

So my question is:

If i have an Homepage Visualforce component, with this element inside:
<apex:column headerValue="Work Approval" id="workApproval">            
              <button type="button" onclick="window.top.location.href = '{!URLFOR(o.link)}'">Work</button>
</apex:column>

Will the "onclick" action still works? Or not, because it interact with the parent window?

Thxs guys ;)
Hello,

We are using communities and we would like to know if we can also use SurveyForce with our commmunities users.
This is the survey Force app - https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003I2gDEAS

Would it be possible to use SurveyForce with Communities instead of sites?

Thanks for your help !

 
I am a newbie when it comes to Apex development, but I am trying to deploy a trigger that sends a task and an email when an opportunity is marked as won. Half of the trigger is working properly, but the most important half is not. Any help is greatly appreciated!

I have a custom field on the Account level named "Customer_Success_Owner_Name__c". The field is a formula that takes another field and returns the name "Brandon", "Kyle", or "Oz". Based on the name in that field, the trigger should create a task and send an email to the correct user, as well as do the same for our finance officer.

The "Open a Payment Record" task is sending correctly. The "Open a Subscription" is acting sporadic and not sending to the correct user when it does actually send.
 
/*Open a Task on Account on a closed won Opportunity */

trigger OpenAccountTask on Opportunity (after update){
    
    List<Id> AccountId = new List<Id>();
    
    for(Integer i = 0; i < trigger.size; i++){
        if(trigger.new[i].StageName == 'Closed Won' && trigger.new[i].StageName != trigger.old[i].StageName)
            AccountId.add(trigger.new[i].AccountId);
    }
    
    if(!AccountId.isEmpty()){
        Task[] tasksToInsert = new Task[]{};
        Map<Id,Account> GetAccountById = new Map<Id,Account>();
        for(Account a : [SELECT Id, Name, Customer_Success_Owner_Name__c, OwnerId FROM Account WHERE Id IN :AccountId]){
            GetAccountById.put(a.Id,a);
        }
        for(Integer i = 0; i < trigger.size; i++){

            /*US Task for Brandon */
            if(trigger.new[i].StageName == 'Closed Won' && trigger.new[i].StageName != trigger.old[i].StageName && (GetAccountById.get(trigger.new[i].AccountId).Customer_Success_Owner_Name__c == 'Brandon')){
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='005700000023zFI', Subject='Open a Subscription',ActivityDate=Date.Today()));
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='005700000026xbg', Subject='Open a Payment record',ActivityDate=Date.Today()));
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();              
                mail.setTargetObjectId('005700000023zFI');
                mail.setSubject('Open a Subscription for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                mail.setSaveAsActivity(false);
                Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
                mail2.setTargetObjectId('005700000026xbg');
                mail2.setSaveAsActivity(false);
                mail2.setSubject('Open a Payment record for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail2.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail,mail2 });
            }

            /*US & EMEA Task for Kyle*/
            else if(trigger.new[i].StageName == 'Closed Won' && trigger.new[i].StageName != trigger.old[i].StageName && (GetAccountById.get(trigger.new[i].AccountId).Customer_Success_Owner_Name__c == 'Kyle')){
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='00570000003DXJb', Subject='Open a Subscription',ActivityDate=Date.Today()));
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='005700000026xbg', Subject='Open a Payment record',ActivityDate=Date.Today()));
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setTargetObjectId('00570000003DXJb');
                mail.setSaveAsActivity(false);
                mail.setSubject('Open a Subscription for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
                mail2.setTargetObjectId('005700000026xbg');
                mail2.setSaveAsActivity(false);
                mail2.setSubject('Open a Payment record for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail2.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail,mail2 });
            }       

            /*AP & Enterprise Task for Oz*/
            else if(trigger.new[i].StageName == 'Closed Won' && trigger.new[i].StageName != trigger.old[i].StageName && (GetAccountById.get(trigger.new[i].AccountId).Customer_Success_Owner_Name__c == 'Oz')){
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='00570000001XWfY', Subject='Open a Subscription',ActivityDate=Date.Today()));
                tasksToInsert.add(new Task(WhatId=trigger.new[i].AccountId, OwnerID='005700000026xbg', Subject='Open a Payment record',ActivityDate=Date.Today()));
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setTargetObjectId('00570000001XWfY');
                mail.setSaveAsActivity(false);
                mail.setSubject('Open a Subscription for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
                mail2.setTargetObjectId('005700000026xbg');
                mail2.setSaveAsActivity(false);
                mail2.setSubject('Open a Payment record for ' + GetAccountById.get(trigger.new[i].AccountId).Name);
                mail2.setPlainTextBody('You can view the details here:\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + trigger.new[i].AccountId);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail,mail2 });
            }
        }
        if(!tasksToInsert.isEmpty())
            Database.insert(tasksToInsert);     
    }
}

 
Hello all, I am new to Apex and am trying to do a simple field update between two custom objects; I looked through other posts and tried to model mine on the others I saw, but I'm getting stuck. In a nutshell, when a date is entered into the Date_Received__c field on the Invoices__c object, that date should be written to the Invoice_Received_Date__c field on the Work_Products__c object. Work_Products__c is linked to Invoices__c via a lookup relationship. Below is the code I have written:

trigger DateReceivedUpdate on Invoices__c (before insert, before update){
   
  List<ID> WorkProductIds = New List<ID>();
   
  for(Invoices__c a : Trigger.new){
   if(a.Date_Received__c != null){
     WorkProductIds.add(a.Work_Product_Name__c);
   }
  }         
  List<Invoices__c> WorkProductsList = [SELECT id, Date_Received__c FROM Invoices__c WHERE id in :WorkProductIds];
   
    Map<id,Invoices__c> mInvtoWP = New Map<id,Invoices__c>();
   
    for(Work_Products__c p : trigger.new)
     mInvtoWP.put(p.Invoice_Received_Date__c, p);
   
    for(integer i = 0 ; i < WorkProductList.size(); i++){
      WorkProductsList[i].Work_Products__c = mInvtoWP.get(WorkProductsList[i].ID).Invoices__c;
    }
        
    update WorkProductsList;
}

Any help that I can get would be greatly appreciated.
Thanks!
Hi All

I am a SF administrator and very new to Apex code and VF. I have some questions for my first apex class and VF. Hope you can help me! 

The objective: on case object, I would like to use Account Name value on case as foreign key to query our custom object Account Technical jurisdiciton (ATJ). The relationship between account and ATJ is one to many. There is no direct relationship between case and Account Technical Jurisdiction object. The VF page should be display some fields value from ATJ when user is viewing a case record. 
But when I put my code in, it says " content cannot be displayed: attempt to de-reference a null object", can any one take a look at the codes below and guide me through?  Thank you! 
Apex Code: public with sharing class IGTCaseConJurExtension {
    public Case cs {get;set;}
    public List < IGT_AccountTechnicalJurisdiction__c> Records {get; set;}
    Public IGTCaseConJurExtension (){    Records = [SELECT Account__c,Id,IGT_Technical_Jurisdiction__c,Jurisdiction_Name__c FROM IGT_AccountTechnicalJurisdiction__c WHERE Account__c =: cs.accountId];
    }
}

VF page: 
<apex:page controller="IGTCaseConJurExtension">
<apex:pageBlock title="Account Technical Jurisdiction">
<apex:pageBlockTable value="{!Records}" var="Record"> 
            <apex:column > 
                <apex:facet name="header">Account Name</apex:facet> 
                <apex:outputText value="{!Record.Account__c}"/> 
            </apex:column> 
            <apex:column > 
                <apex:facet name="header">IGT Technical Jurisdiction</apex:facet> 
                <apex:outputText value="{!Record.IGT_Technical_Jurisdiction__c}"/> 
            </apex:column> 
            <apex:column > 
                <apex:facet name="header">Jurisdiction Name</apex:facet> 
                <apex:outputText value="{!Record.Jurisdiction_Name__c}"/> 
            </apex:column> 
        </apex:pageBlockTable> 
</apex:pageBlock>
</apex:page>
Hi Guys,

I am trying to develop a trigger(not sure if it is possible through Apex Triggers) to save a custom object record as a pdf document and then attach the same document to that record. we have a custom object called Research, what we want to achieve is when a certain date field is entered and saved then the data in that research record must be saved as a PDF document and get attached to the same record. 

I am not sure if this is achievable through triggers only. can anyone give any suggestions for how this can be achieved?

Thanks,
  • April 08, 2015
  • Like
  • 0
I am adding picklist values in Selected Values through Metadata API for a particular recordtype. but the existing selected values are removing when i assign new values to Selected values.

how to get the existing values from RecordTypePicklistValue[] in Metadata API or else only those two new values to be added in the Selected Values.

Code:     

MetadataService.RecordType rt = new MetadataService.RecordType();
rt.active = true;
rt.fullName = 'Lead.Marketing';
rt.label = 'Marketing';

    // Add pick list values
        metadataservice.PicklistValue two = new metadataservice.PicklistValue();
        two.fullName= 'second';
        two.default_x=false;
        metadataservice.PicklistValue three = new metadataservice.PicklistValue();
        three.fullName= 'third';
        three.default_x=false;

MetadataService.RecordTypePicklistValue ohmVersions = new MetadataService.RecordTypePicklistValue();
ohmVersions.Picklist = 'Picklist__C';
ohmVersions.values = new MetadataService.PicklistValue[] { two,three};
rt.PicklistValues = new MetadataService.RecordTypePicklistValue[] { ohmVersions };

return handleSaveResults( service.updateMetadata( new MetadataService.Metadata[] { rt })[0]);
      

Thanks,
Krish