• Ashok N 8
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello All,

I am looking at getting help for merging two word documents. Below is the smaple code i have tried and not working. Please help me with sample code.
1. The first doc one is a VF page rendered as word doc.
2. The second doc is an attchment/Static Resource. 

Sample Code
1. VF Page
<apex:page renderAs="" contentType="application/vnd.msword#TC.doc" controller="TCCont">
    <apex:outputText value="{!textFromSomeUniqueName}">
    </apex:outputText> 
</apex:page>

2. Controller

public class TCCont {
    
    public Attachment textFromSomeUniqueName {
        get {
            Attachment att = [Select Body from Attachment where ParentId='a089000001ZtT8m' ];
            return att;
        }
    }
The challenge is to search for the inserted record with an inline SOSL search, using Execute Anonymous.

This is what I did using Execute Anonymous Window
 
List<List<sObject>> searchList = [FIND 'Mission Control' IN ALL FIELDS 
                                  RETURNING Contact(FirstName, LastName,
                                  Phone, Email, Description)];
Contact[] searchContacts = (Contact[])searchList[0];
System.debug('Found the following contacts:');
for (Contact c : searchContacts) {
   System.debug('"'+c.LastName + ', ' + c.FirstName+'"');
}

But still there's an error when I check the challenge.

Challenge Not yet complete... here's what's wrong: 
Could not find the contact's name in the debug log. Be sure to run a query for your record, and to write your contact's name to the debug log using the System.debug() method.