Loading
ただいま大変多くのお問い合わせをいただいており、ご連絡までにお時間を頂戴しております続きを読む
Omnistudio Document Generation
目次
絞り込み条件を選択

          結果がありません
          結果がありません
          検索のヒントをいくつかご紹介します

          キーワードの入力ミスがないか確認する。
          より一般的な検索語を使用する。
          絞り込み条件を減らして、検索範囲を広げる。

          Salesforce ヘルプ全体を検索
          Sample Apex Code for Generating Quotes in Batch

          Sample Apex Code for Generating Quotes in Batch

          Here is a sample of Apex code that carries out two main functions. First, it creates a record named DocGenerateBatchProcess which is responsible for generating quotes. Second, it creates a list of 100 quote documents and links these documents with the DocGenerateBatchProcess record. To start a batch using Apex, update the Status field to InProgress. This value is case sensitive, and the batch runs automatically after the status is updated.

          Create a DocGenerateBatchProcess record for generating quotes

          DocGenerationBatchProcess dgbp = new DocGenerationBatchProcess( Description = 'Generate Quotes in Bulk', Category = 'Quotes');
          insert dgbp;
          

          Create a list of 100 quote documents and associate them with the DocGenerateBatchProcess record

          DocGenerationBatchProcess dgbp = new DocGenerationBatchProcess( Description = 'Generate Quotes', Category = 'Quotes');
          insert dgbp;
          List<DocumentGenerationProcess> dgpList = new List<DocumentGenerationProcess>();
          String quoteId = '0Q0OG0000000Yoc0AE';
          String quoteTemplateContentVersionId = '068OG0000003iy6YAA'; 
          String sampleTokenData = '{"SUBSCRIBER_NAME":"Subname","STREET1":"Panathur","CITY":"Blr","STATE":"KA","POSTALCODE":"494001","COUNTRY":"India"}';
          
          for(Integer i=1; i<=1; i++) {
          	String docTitle = 'Quotes'  + i;
          	DocumentGenerationProcess dgp = new DocumentGenerationProcess (
            		Type = 'GenerateAndConvert', Status = 'InProgress',
          		RequestText='{"keepIntermediate":true, "title":"' + docTitle + '","templateContentVersionId":"'+quoteTemplateContentVersionId+'"}',
            		TokenData = sampleTokenData,
            		ReferenceObject = quoteId, 
            		DocGenApiVersionType='Advanced',
            		DocGenerationBatchProcessId = dgbp.Id
          	);
          	dgpList.add(dgp);
          }
          insert dgpList;
          

          Parameters

          Parameter Description
          DocGenApiVersionType

          Defines the API version that you want to use for document generation. To support rich text and hyperlink tokens for document generation process records, set the Doc Generation API Version Type setting to Advanced.

          docTitle

          Document title.

          quoteId

          ID of the quote.

          quoteTemplateContentVersionId

          Document template content version ID.

          ReferenceObject

          Indicates the object that the generated document is attached to. In the sample Apex code, Account ID is the reference object. The generated document is saved in the Notes and Attachments section of the account.

          requestText
          • templateContentVersionId: Content version ID of the document template that you want to use.

          • title [optional]: Title for the generated document. For example, NewDocDemo.

          • keepIntermediate: When set to true, the system persists with the generated intermediate Word document and the final PDF document.

          Status

          Status of the document generation batch process request: Canceled, Completed, In Progress, New, or Paused.

          templateContentVersionId

          ID of the document associated with the batch process.

          TokenData

          Stores the JSON key-value pair that's used as an input for server-side document.

          Type

          GenerateAndConvert: Generates a Word document and creates a PDF document.

           
          読み込み中
          Salesforce Help | Article