BPM, Workflow, and Case

Expand all | Collapse all

Questions for web file & common functions for BAW

Jump to Best Answer
  • 1.  Questions for web file & common functions for BAW

    Posted Wed July 28, 2021 09:54 AM

    Hi guys, 

      May help on below 2 questions, tks in advance!

    - It's able to access web files like images in events of coach view by below approach. However, this way not working in client-side script. So plz advise how to use such images in client-side script, tks!

    com_ibm_bpm_coach.getManagedAsetUrl('image.png',com_ibm_bpm_coach.assetType_WEB)

    - How to define a common function which can be used by any coach view & client-side script? Tks!



    ------------------------------
    Farseer J
    ------------------------------



  • 2.  RE: Questions for web file & common functions for BAW
    Best Answer

    Posted Wed July 28, 2021 10:19 AM
    Hi Farseer,

    1. This API does not work in client side scripts, it will only work within Coaches. So you need to have a service flow to get the URL using below API from server script - 
    tw.system.model.findManagedFileByPath('myimage.png', TWManagedFile.Types.Web).url;

    2. Don't think any generic function can be created to make use these different APIs together.

    ------------------------------
    Atanu Roy
    ------------------------------



  • 3.  RE: Questions for web file & common functions for BAW

    Posted Thu July 29, 2021 11:28 AM
    Edited by Farseer J Thu July 29, 2021 11:28 AM

    Hi @Atanu Roy, tks for your answers​.

    For the image url, i think your API is right but it saids TWManagedFile is not defined. Seems I miss some dependencies here after I check all toolkits and barely TW* objects found. There're no TWManagedFile and other TW* items like TWDate. I try to add all available toolkits but still same. May u help to advise here? Many Tks!

    Regarding the generic function,  actually I trying to find a way to define it. e.g., in one Workflow app, we have same functions to format a string in more than one client-side scripts,  Im trying to find a best way to define the method in one place in order to make it can be easily invoked by client-side script or coach view, just simply like a imported JS file on html page.



    ------------------------------
    Farseer J
    ------------------------------



  • 4.  RE: Questions for web file & common functions for BAW

    Posted Thu July 29, 2021 11:34 AM
    Hi Farseer,

    As I mentioned, you need to use this API in a service flow, within a server script, this is a server side API.
    You cannot combine server side and client side functions together, server side JS library needs to be uploaded as server file and client side JS library needs to added as Web file.
    For CSHS, as far as I know, even if you use client side JS library uploaded as Web file, functions from the library cannot be referenced in client side script in CSHS.




    ------------------------------
    Atanu Roy
    ------------------------------



  • 5.  RE: Questions for web file & common functions for BAW

    Posted Thu July 29, 2021 10:36 PM
    Tks Atanu, that made sense to me.

    ------------------------------
    Farseer J
    ------------------------------