Task Based UI @ Siebel 7.8 | Next Tip »Home

Siebel Document Generation and VBA Programming

OkAvarageGoodVery GoodExcellent (No Ratings Yet)
Loading ... Loading ...

I have had chance to work on very different requirements in Siebel which we don’t often come across in Siebel. This time I am going to share with you guys my experience of working a different requirement involving Document Server and VBA Programming.

Requirement:

  • Create Word templates in Siebel which will be used to generate word documents by the users (I know nothing different so far).
  • Master templates will have content in them which will be preceded by a code in square bracket for example:
    [NNIIOO] This is a paragraph that should be included in document
    [JJOOII] This is another line preceded by a Code
    [KKOOPP] INSERT MyFile.doc
    and so on
  • In a Field named “Doc Code” we would store codes received from a different application through integration for example: [JJIIOO] [NNIIOO] [98FGJ] [RRTTYY]
  • When user selects a template and starts Document Generation process we had to get the codes stored in the “Doc Code” Field and compare them against the codes present in Master Template.
  • If a code is present in “Doc Code” field and also in Master Template then that content should be remain otherwise the content should be deleted.

So if I take codes given in above example then the document that has to be generated should only contain 1 line coming after [NNIIOO] code

(I have tried to explain the requirement as simply as I can but if you have any questions or doubts do let me know I will try to clear them)

Problem:
As it might be clear to you that this requirement is not possible through normal document generation process which involves creating  a mapping of a field (in Siebel) with bookmarks (in templates)

We had to use a very different approach to complete this requirement.

Solution:

  • Created a mapping with Doc Code Field and associated this mapping with all the templates (normal process).
  • Wrote a Macro in Microsoft Word (try pressing ALT + F11 on a blank word document) which would take the values code values from a bookmark (populated due to mapping with “Doc Code” field) and compare them against codes present in word and delete the content that is not required.
  • Invoke this macro on Auto Close event of the Word Document

And the problem was solved

How it works?

Below are the events that happen at document server once you submit a request to generate a template

  • Document Server creates a word document in Temp file
  • Opens that File and puts the content according to the mapping
  • Closes the document
  • Store the generated document in file System.
  • Attach the document to the record for which request was invoked.

When document server tries to close the document our macro starts executing and modifies the document as per the requirement. You can use this approach to change formatting of a document, change content of document or even inserting Objects such as JPEG, another word document or VSD files. I will try to put some technical details to help you understand this in better way but cannot promise that.

In case if you have had chance to work on similar requirements or very different requirements do share your experience with us.

  • Share/Bookmark

Related Posts


Article by neel

Authors bio is coming up shortly. neel tagged this post with: Read 387 articles by neel
blog comments powered by Disqus

Polls

Do you like the new Comment System and new look to Site?

View Results

Loading ... Loading ...