Sterling OMS Template Customization

By | 04/01/2018

Sterling OMS Template Customization

Sterling OMS Template Customization

Sterling OMS Template Customization

Different Ways to Override Template for API/Service

  • Overriding the template file
  • Applying template at Service Configuration Level
  • Override template using Java / XSLT program

How to override createOrder API output ?

Did you notice when you call create order API the result will have only 4 attributes ? (as shown below). How do we override the output ?

  • Copy the file from <OMS Install Dir>\repository\xapi\template\merged\api\createOrder.xml to <OMS Install Dir>\extensions\global\template\api\createOrder.xml
  • Edit the newly copied file (createOrder.xml) and add the Elements as you needed
  • Build Resource jar by running command from OMS bin folder deployer.cmd -t resourcejar
  • Perform build and deploy
  • Call the createOrder API using API tester to see the result

How to get Extended Column value part of getItemDetails API ?

  • How to add/extend column read this link
  • Copy the file from <OMS Install Dir>\repository\xapi\template\merged\api\getItemDetails.xml to <OMS Install Dir>\extensions\global\template\api\getItemDetails.xml
  • Edit newly copied file (getItemDetails.xml) and add <Extn /> as shown <Item></Extn /></Item>
  • Build Resource jar by running command from OMS bin folder deployer.cmd -t resourcejar
  • Perform build and deploy
  • Call getItemDetails using API tester with below input and without any template

  • Output contains <Extn /> in the result

How to apply template for custom table ?

  • Build Resource jar by running command from OMS bin folder deployer.cmd -t resourcejar
  • Perform build and deploy
  • Configure new sync service createStudent with Extended Database API (Drop down select createStudent)
  • Call createStudent service using API tester with below input and without any template

  • Result contains only 4 attributes as given part of output template

Applying template at Service Configuration Level

For any API, template can be overridden using below configuration method.

IBM OMS Template Configuration

Applying Template Using Java Program

setApiTemplate and clearApiTemplate methods called from env object

Event Template Customization

  • Copy from INSTALL_DIR/repository/xapi/template/merged/event/ORDER_CREATE.ON_SUCCESS.xml to INSTALL_DIR/extensions/global/template/event/ORDER_CREATE.ON_SUCCESS.xml
  • Edit the newly copied XML as per requirement (Add Attributes)
  • Build Resource jar by running command from OMS bin folder deployer.cmd -t resourcejar
  • Perform build and deploy
  • Enable ON_SUCCESS event in CREATE_ORDER transaction
  • Capture ON_SUCCESS event by adding action which contains YFS_EXPORT DB component (Testing Only)
  • Call createOrder API using API tester

Interview Questions on Template Customization

  1. what are all the different argument available with setApiTemplate() method ? Answer :
    • setApiTemplate(api_name, file)
    • setApiTemplate(api_name,xmlDocument)
  2. When setApiTemplate(api_name, file) used what location file been picked from ? Answer : folder location INSTALL_DIR/extensions/global/template/api
  3. How to clear API template which set using Java Program ? Answer : clearApiTemplate(api_name)
  4. How to clear more than one API template ? Answer : env.clearApiTemplates()
  5. If template available in different places how the priority works ?
    • setApiTemplate(file or Document) to YFSEnvironment Object (Priority 1)
    • INSTALL_DIR/extensions/global/template/api/apiName.docType.xml (Priority 2)
    • INSTALL_DIR/extensions/global/template/api/apiName.xml (Priority 3)
    • If still not found apply the OOB template (INSTALL_DIR\repository\xapi\template\merged\api)
  6. How to override template for user exit ? Answer : Sorry Template override not applicable for user exits

Thanks for reading this post till the end. Please share your comments/feedback below. Any question you can write to as support@activekite.com

Please share this blog information to your friends. Lets learn together. Happy Learning !!!

Register with us to get more OMS learning updates

Sterling OMS Interview questions

6 thoughts on “Sterling OMS Template Customization

  1. Kumar

    I have a scenario, if I need to get the stores around a particular zip code within radius of X km. How can we configure it in sterling and how can we fetch the stores

    Reply
    1. admin Post author

      Kumar,

      Please refer getSurroundingNodeList API. This is give you exactly you are looking for you. Keep learning !!!

      Reply
  2. PTI

    Awsome!! very helpful for someone recently started working on Sterling..

    Reply
  3. Jaffar

    How can, customize template for User Exit in sterling. If yes, how can we achieve it.

    Reply
    1. admin Post author

      Please refer \xapidocs\code_examples\java\YPMGetItemPriceUEWCIntegrationImpl.java ( 3 files). This file has example how template can be used. Hope this helps !!!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *