• Shekhar Gadewar 16
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Dear Friends,
need some help.

Issue Description:

We have a trigger/class that default the user profile to a specific profile when it is created, the trigger is tested and works as expected.

But when we try to create users from pentaho job that synchs salesforce with AD then we are getting the following error in the log files


Error Code:
Error while doing upsert operation, error message was: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 1631076695-26350 (-1115084976) ;;SalesforceUpsert002


Any idea on this?

Thanks
Hi.
I am trying to create a word file by visualforce.
I am trying to attach it as an attachement for an accout record.

Everything is working fine, the file is getting generated and getting attached to current account record.
But when I try to open the word file for reading.
it's saying :

User-added image

Can some guide, where I am making the mistake?

Thanks in advance.
=================

Here is the code I ma using:

<apex:page controller="WordAttachementGeneratorController"> 
  <apex:sectionHeader title="Word Example" description="Example of how to attach a Word to a record."/>

  <apex:form >
    <apex:pageBlock title="Word Input">

      <apex:pageBlockButtons >
        <apex:commandButton action="{!saveWord}" />
      </apex:pageBlockButtons>
      <apex:pageMessages />

      <apex:pageBlockSection >

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="pdfName"/>
          <apex:inputText value="{!WordName}" id="pdfName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Account ID" for="id"/>
          <apex:inputText value="{!parentId}" id="id"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>

</apex:page>
public with sharing class WordAttachementGeneratorController{

  public ID parentId {get;set;}
  public String WordName {get;set;}

  public PageReference saveWord() {

    PageReference pdf = Page.PdfGeneratorTemplate;

    // create the new attachment
    Attachment attach = new Attachment();

    // the contents of the attachment from the pdf
    Blob body;

    try {

        // returns the output of the page as a PDF
        body = pdf.getContent();


    } catch (VisualforceException e) {
        body = Blob.valueOf('Some Text');
    }

    attach.Body =   body;
    // add the user entered name
    attach.Name = WordName ;
    attach.IsPrivate = false;
    // attach the pdf to the account
    attach.ParentId =parentId ; 
    insert attach;

    // send the user to the account to view results
    return new PageReference('/'+parentId);

  }

}
<apex:page standardController="Account"  contentType="application/msword#sfdcsrini.doc" cache="true">

<html xmlns:w="urn:schemas-microsoft-com:office:word">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<body>
<apex:outputText title="Welcome to word"/>
<br/>
<br/>
<apex:pageBlock >
<div style="text-align:left" >
Hello! 
</div>            
</apex:pageBlock>
</body>
</html>
</apex:page>




Hi.
I am trying to create a word file by visualforce.
I am trying to attach it as an attachement for an accout record.

Everything is working fine, the file is getting generated and getting attached to current account record.
But when I try to open the word file for reading.
it's saying :

User-added image

Can some guide, where I am making the mistake?

Thanks in advance.
=================

Here is the code I ma using:

<apex:page controller="WordAttachementGeneratorController"> 
  <apex:sectionHeader title="Word Example" description="Example of how to attach a Word to a record."/>

  <apex:form >
    <apex:pageBlock title="Word Input">

      <apex:pageBlockButtons >
        <apex:commandButton action="{!saveWord}" />
      </apex:pageBlockButtons>
      <apex:pageMessages />

      <apex:pageBlockSection >

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="pdfName"/>
          <apex:inputText value="{!WordName}" id="pdfName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Account ID" for="id"/>
          <apex:inputText value="{!parentId}" id="id"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>

</apex:page>
public with sharing class WordAttachementGeneratorController{

  public ID parentId {get;set;}
  public String WordName {get;set;}

  public PageReference saveWord() {

    PageReference pdf = Page.PdfGeneratorTemplate;

    // create the new attachment
    Attachment attach = new Attachment();

    // the contents of the attachment from the pdf
    Blob body;

    try {

        // returns the output of the page as a PDF
        body = pdf.getContent();


    } catch (VisualforceException e) {
        body = Blob.valueOf('Some Text');
    }

    attach.Body =   body;
    // add the user entered name
    attach.Name = WordName ;
    attach.IsPrivate = false;
    // attach the pdf to the account
    attach.ParentId =parentId ; 
    insert attach;

    // send the user to the account to view results
    return new PageReference('/'+parentId);

  }

}
<apex:page standardController="Account"  contentType="application/msword#sfdcsrini.doc" cache="true">

<html xmlns:w="urn:schemas-microsoft-com:office:word">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<body>
<apex:outputText title="Welcome to word"/>
<br/>
<br/>
<apex:pageBlock >
<div style="text-align:left" >
Hello! 
</div>            
</apex:pageBlock>
</body>
</html>
</apex:page>




Hi.
I am trying to create a word file by visualforce.
I am trying to attach it as an attachement for an accout record.

Everything is working fine, the file is getting generated and getting attached to current account record.
But when I try to open the word file for reading.
it's saying :

User-added image

Can some guide, where I am making the mistake?

Thanks in advance.
=================

Here is the code I ma using:

<apex:page controller="WordAttachementGeneratorController"> 
  <apex:sectionHeader title="Word Example" description="Example of how to attach a Word to a record."/>

  <apex:form >
    <apex:pageBlock title="Word Input">

      <apex:pageBlockButtons >
        <apex:commandButton action="{!saveWord}" />
      </apex:pageBlockButtons>
      <apex:pageMessages />

      <apex:pageBlockSection >

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="pdfName"/>
          <apex:inputText value="{!WordName}" id="pdfName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Account ID" for="id"/>
          <apex:inputText value="{!parentId}" id="id"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>

</apex:page>
public with sharing class WordAttachementGeneratorController{

  public ID parentId {get;set;}
  public String WordName {get;set;}

  public PageReference saveWord() {

    PageReference pdf = Page.PdfGeneratorTemplate;

    // create the new attachment
    Attachment attach = new Attachment();

    // the contents of the attachment from the pdf
    Blob body;

    try {

        // returns the output of the page as a PDF
        body = pdf.getContent();


    } catch (VisualforceException e) {
        body = Blob.valueOf('Some Text');
    }

    attach.Body =   body;
    // add the user entered name
    attach.Name = WordName ;
    attach.IsPrivate = false;
    // attach the pdf to the account
    attach.ParentId =parentId ; 
    insert attach;

    // send the user to the account to view results
    return new PageReference('/'+parentId);

  }

}
<apex:page standardController="Account"  contentType="application/msword#sfdcsrini.doc" cache="true">

<html xmlns:w="urn:schemas-microsoft-com:office:word">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<body>
<apex:outputText title="Welcome to word"/>
<br/>
<br/>
<apex:pageBlock >
<div style="text-align:left" >
Hello! 
</div>            
</apex:pageBlock>
</body>
</html>
</apex:page>