• Vjartz
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
has anybody had any problems with their APEX code with summer 09, mine started workgin in really strange way not like it designed to, it completely runs away in a different direction
  • June 15, 2009
  • Like
  • 0

Hello,

 

Our organization no longer has an in-house developer and we have several projects that we are looking to outsource.  We have an urgent project that we'd like to have completed by next Wednesday, 3/25.  Based on how well this project goes, we will have other opportunities to follow.

 

Please contact me at meg@merchantresource.com if you are interested helping us out!

 

Meghan Meierdiercks

Here’s what we need to do:

We want to copy records from a Master-Child object to another Master-Child object using Apex Trigger.

Data Model: 

Purchase Requisition – Item List (Master-Child)

Purchase Order – Receiving (Master-Child)

Scenario:

A Purchase Requisition contains many Item List.  The data is locked after approval.  I want to issue a Purchase Order by clicking a button.  The clicking of the button should trigger the creation of the Purchase Order by copying the data from Purchase requisition to Purchase Order object and the data from the Item List are copied to the Receiving object.

Please send me a quote If you are interested.  You can contact me at venriquez@cicondemand.com

Thanks,

Victor Enriquez

  • March 09, 2009
  • Like
  • 0
Dear Friends

I want to create a html attachment and attach it in email.
I got an exception when setting email attachment
body, the Apex codes like this:
=====================================================================
    // Encode the html string as base64 and then create an attachment  
    Blob html = Crypto.generateDigest('SHA1',Blob.valueOf(htmlBody));
    Attachment attachment = new Attachment();

    // set attachment body - base64, and
name
    attachment.Body = Blob.valueOf(EncodingUtil.base64Encode(html));
    attachment.Name = String.valueOf('Task.html');

    // if WhatId is not null, set the
attachment.ParentId to WhatId
    // else set the
attachment.ParentId to WhoId
    if (newTask.WhatId != null) {
        attachment.ParentId = newTask.WhatId;
    } else {
        attachment.ParentId = newTask.WhoId;
    }
    insert attachment;
   
           // add the
attachment to an email message
line251    Messaging.EmailFileAttachment[] fileAttachments = new Messaging.EmailFileAttachment[1];
line252    fileAttachments[0].setBody(attachment.body);
line253    fileAttachments[0].setFileName(attachment.Name);
line254    mail.setFileAttachments(fileAttachments);
=====================================================================
Error message like this:
SendAlertMail: execution of AfterInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.SendAlertMail: line 252, column 21

But I can get the attachment.Name after the "insert attachment" operation.
And I can found the created attachment in related Opportunity.
Can anybody give me some advices?

Thanks


  • December 02, 2008
  • Like
  • 0