Posted: 27 May 2018 6:29 EDT Last activity: 16 Oct 2018 7:03 EDT
***Edited by Moderator Marissa to update categories***
How do we call this JS method ? If as per our understanding we need to call it from a function that is written in the JS file. Also we have to save the data that is fetched from this function into clipboard so that the moment the section is loaded we are able to see the data set into pyWorkPage which can be used for further calculations.
If we use non-auto generated section then we have to create a the entire section using HTML which is not possible as maintenance for this section will be high. Moreover since it is offline enabled application what ever data we put gets stored in the client cache.
I mean what we can do is drop a new section into the current section(Auto-Generated). Now, this newly created section should be non-autogenerated which will have the script code. We could also write script code in userworkform but it would be called on every screen in this scenario.
I did some research and could come up with a code which would be called when the section gets loaded.
What it does is there will be a timeout configured which will be called recursively since we don't know how much time the section would take to load. When the particular section(eg: Section name is Sample in m case) get loaded this would terminate.
Yes we have used timeout but we are seeing that the script is getting called next time when we login. In our scenario we have to set some values into pyWorkPage immediately when the cases is opened from the worklist. We are seeing that the value is getting set if the user logs off & logs in again & opens the same work object again. In the script we have called an activity & in the activity we have used log message in which we are trying to check the key of the work object in this format as “Fetched work object key is” +Param.FetchedWO. We are seeing that the first time it is showing only “Fetched work object key” in the log but next time when we open the work object after log off & login we are seeing ”Fetched work object key is” A-B-C WO-123 getting logged & proper value getting set into clipboard.
I have written "console.log("ab");". Did you try to debug if this is getting printed in the console for the first time? You can try first try in Desktop version since it will be easier. Please note that this will be called only when the section gets loaded.
I could not find any issue with the code. You need to debug this.