I’m trying to get a client script to run on the request screen once the data has been loaded. (FSM 6.5 Smart Client). I have a simple script with just alert(‘Test’);. I’ve linked it to different screen events but it never seems to run. I noticed that all the other baseline scripts linked to the screen are for the web client. Is it possible to do this with the smart client?
Just in case there’s a better way to accomplish my goal, here is what I’m trying to do… I have a YorN check box on the task screen linked to TASK.USER_DEF1. I also have a checkbox on the request screen which I want to be checked if any of that request’s tasks have it’s box checked..
Thanks!
Page 1 / 1
Hi,
You can accomplish this, by adding the initial focus to request.place_id field in UI Designer. Then attach a client script to request.place_id - GotFocus event.
Thanks..
Hi @csanders,
This is possible with Client Script for the Smart Client. And the code should run.
However though there are less possibilities with client scripting for Smart Client. If you want to check what is possible, you should click the right mouse button in the client script code. This will show you a menu with all the possible functions/methods that you can run.
When you are trying to trigger the client script, be sure to refresh cache, and maybe even use Refresh Cache (Full). It is also possible with a custom process/business rule with much less effort. You should then create a Custom Process of the type ‘XML’.
I don't know your level of experience. But you should create a Custom Process of the Type XML. Then go to Business Rules screen and look up your custom process in the list. Over there create your rule and create two input parameters for it both with Table Name = ‘task’ and Column Name = ‘user_def1’.
Then navigate into the rule id hyperlink to the rule conditions and press New to create your rule condition. You will find your parameters in the screen. The first variable should have the operator ‘Changed’. The second variable should have the operator ‘Equal’ and the value ‘Y’. This way the rule is only triggered when you update the task.user_def1 field to the value ‘Y’. Press ‘Save’ before you proceed.
You can now pass the following XML in the XML_MESSAGE output parameter.
This xml message will set your field to the right value. You might have to change the user_def1 tag, because you didn't mention which field on the request table you want to update.
Don't forget to run the ‘Refresh Cache’ function AND start up your screen again. People tend to think that this last thing doesn't matter, but it does with FSM and actually also other business applications (only the context might be different).
Hope this helps.
Kind regards,
Jos de Pijper
You can accomplish this, by adding the initial focus to request.place_id field in UI Designer. Then attach a client script to request.place_id - GotFocus event.
That works. Thanks!
@josdepijper Thanks for all the info! The checkbox on the request screen is also set to TASK.USER_DEF1. Apparently this used to work on FSM 5.6.3 and stopped working after we updated to 6.5. I’m not sure how it worked as there could be 15 tasks on a request, but that’s what I’m told.
The checkbox on the request screen is just so you can tell at a glance if any of the tasks have the box checked. It doesn’t need to be saved in the request table. When I got the script working it will check the box but then it asks the user if they want to save changes when they leave the screen even if they didn’t make changes which is not ideal.
So far using a request table udef and a business rule as you suggested seems like the best solution if I can’t figure out how we had this working previously.
Thanks for your help guys.
I ended up just using a request udef and getting rid of the task udef. Mobile users can update the request checkbox through a script linked to it.