Calling Scripts in ITShop

I have created a class in my script library and want to access that class to load/parse and serialize our custom data objects in json format in ITSHOP, any ideas how to access that class from ITSHOP and what would be the best approach to handle json in ITSHOP?

Parents
  • Hi Qazi,

    ITSHOP is a configuration parameter in Designer. I don't get it, what you want with your script and serialization and json for a boolen parameter.

    Regards,
    Geraldine

  • Hi Geraldine,

    Here is the scenario.

    I have created some scripts in the script library in designer to process data. 

    And I'm creating a form in web designer where a user will enter data, and before saving that data to Database, I want to process the inputs using those scripts which are created in script library. How can I call those scripts from web designer?

  • Hi Qazi,

    ok, that is much clearer.

    You could use the action node "Object Method" to "Raise an event" in Web Designer. Define the collection (where the data to proof is stored) and add parameters/variables if you need.

    In Designer you add the event, add the process and call your script.

    This is a very common pattern in Web Designer, to sneak how it is used in the standard just use the search function:

    HTH,
    Geraldine

  • Thank you Geraldine, that's perfect, would use it to push data to script.

    Now the only other thing this approach doesnt cover would be following scenario:

    I have a script that processes data in person table and returns a string. I want to call that script from webdesigner and show the result string in webdesigner. I cant think we can accomplish that using object method.

  • You can call the script from the front end as a value of a collection property (e.g. MyScript(from vars select uid_person)). The script would have to return a string (maybe , or | separated), this value will be stored in your collection variable. Then you can deserialise this variable in the front end directly.

    The main point to remember here is that your script needs to return a string, and you need to think how you will parse that in the front end. Unfortunately there is no built in JSON parser function as far as I know, so in the past I have resorted to parsing my script return values based on string splits.

Reply
  • You can call the script from the front end as a value of a collection property (e.g. MyScript(from vars select uid_person)). The script would have to return a string (maybe , or | separated), this value will be stored in your collection variable. Then you can deserialise this variable in the front end directly.

    The main point to remember here is that your script needs to return a string, and you need to think how you will parse that in the front end. Unfortunately there is no built in JSON parser function as far as I know, so in the past I have resorted to parsing my script return values based on string splits.

Children
  • Thank you Kinshasa for the response.

    For JSON Parsing and serialization I have a class in script library, I want to set properties of that class from front end and then would call the serialize method on that class, which will return a string that I can then save as in a custom column on the table.

    The problem is, how to expose this class in frontend(web designer), do I need to compile it as a separate dll and load it in webdesigner or is there an easier way to achieve this? 

  • Hi

    I don't think you need a separate DLL. To call your script, just use a property in a collection, and as the value use the script name and pass the parameter. All scripts are available in the front end by default, just call it like you would call a script in the backend.