Variables null after useraction node

Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>
Author
Messages
BarbR
Veteran Member
Posts: 306
Veteran Member
    I have just discovered that global variables in my process flow that were assigned a value using Javascript statements revert to null values after a user action node.  This is a serious issue that is affecting flow path, data updates, and data notifications.  We are 9.0.1.10.
    Is this a known issue?
    Kyle Jorgensen
    Veteran Member
    Posts: 122
    Veteran Member
      That is how the application works. Variables set in Javascript are non-persistent variables.
      The work around is to create a persistent variable in the start node. Then have the value set in the Javascript. Then 'reset' the same variable with the same value in the Assign node.
      BarbR
      Veteran Member
      Posts: 306
      Veteran Member
        Thanks for the info, wish I'd known that before I started using Javascript.
        Do you know if the HRUserAction and the UserAction nodes are the only two nodes that "reset" non-persistent variables?
        ajn
        Basic Member
        Posts: 13
        Basic Member
          If you use the workobject node to transfer to another service this also resets variables.
          Kyle Jorgensen
          Veteran Member
          Posts: 122
          Veteran Member
            I recommend you refer to the ProcessFlow Users Guide that discusses persistent vs. non-persistent variables. Variables set via Javascript are not the only non-perisistent variables. Any variables that are a node's ouput are non-persistent (such as columns from a DME or SQL query node, or nodename_errorCode).
            BarbR
            Veteran Member
            Posts: 306
            Veteran Member
              Thanks Kyle, I'll review this. I was aware of it, but confused Global variables with Persistent variables. I thought that if I defined the variable in the Start node (Gloal variable) that a value assigned to it (via any method such as Javascript) would persist.
              Kyle Jorgensen
              Veteran Member
              Posts: 122
              Veteran Member
                In order for a variable's value to be written to the WFACTVAR table, the value needs to be set in either the start node or in an Assign node using the Lawson proprietary set method (not Javascript). Also note that the length limit of the "Variable Value" column in the WFACTVAR table is 250 characters. So even persistent variables or MsgBuilder variables longer than 250 characters will get truncated when a flow resumes after a UserAction.
                GeoffTSJY
                Basic Member
                Posts: 16
                Basic Member
                  I know this is an old thread but...

                  Anyone realize how absolutely moronic it is for this practice in the product? First and foremost, the desktop simulation should simulate this. It is horrible that they make you wait until you upload your code to the server to find out that your code doesn't work. What blatant disregard for your customers' time and efforts. And way to give us the ability to "test" when testing doesn't actually replicate the environment that the code will be in. Isn't that the whole idea of a test???!

                  2nd, if I make a series of javascript functions that I can pass parameters into to perform a series of common, repetitive/situational tasks (pretty much the foundation of procedural programming), then each time I return from a node that suspends the server process (like a UserAction) then I have to redefine these functions. Now you might say: oh, just copy and past them. Then if I make a change I need to copy and paste it everywhere? This is the opposite of what you want to do when practicing good programming design. Lawson needs to hire designers and developers that know a thing or two about design and software.
                  Peter O
                  Veteran Member
                  Posts: 69
                  Veteran Member

                    Welcome to Landmark IPA my friend. Unfortunately, I think you've stumbled upon an all-too-common practice in this agile-development world... where dev teams are so "agile" that they focus only on releasing new features while using their customers as QA, this mentality is what you've stumbled on, not just this silly situation with IPA that defies development logic.

                     

                    Just wait until you try to use the E4X standard thats in IPA. Or, better yet, wait until you find out that implicit javascript casting doesn't work properly in many situations in IPA 10.1.1.x, or that if you try to test a variable as being undefined, in SOME instances you need to you =="undefined" and in SOME others you need to use == undefined, the same goes for NULL values. Sometimes you can't catch an undefined variable at all - even though you can see the variable in the log.

                    This starts to make me want to pull my hair out- and then, when you submit the ticket... guess what. It's not a JT, no.... it's an "ENHANCEMENT REQUEST". You know, those requests no one knows how to find to upvote and that no one sees for years?

                    Yeah, submit one of those.

                     

                    Or, along these same lines, wait until you try to use the Application Config console and you realize that certain code is only accepted under certain contexts, and that real LPL doesn't work in all the situations, even though it should. or that you can force the ConfigConsole to accept some code that it otherwise wouldn't if you just open and save it really fast.

                    It makes one's heart grow warm.

                    FireGeek21
                    Veteran Member
                    Posts: 84
                    Veteran Member
                      I echo Peter O's response and add the frustration of reporting an issue and hearing Infor tell you "It's working as designed".  
                      GeoffTSJY
                      Basic Member
                      Posts: 16
                      Basic Member
                        Wow, I didn't know half of those problems. I am newer to the Infor/Lawson world. I was just about to start doing my alternate solution with XML variables and E4X expressions in the Lawson Process Designer. I really want to use some sort of organized data structure that will be persistent rather than using the rudimentary variables they seem to want you to use. Should I just skip the E4X?
                        Woozy
                        Veteran Member
                        Posts: 709
                        Veteran Member
                          Hi GeoffTSJY,
                          I'm a little confused by your comments. This really isn't a big issue, as long as you know how the tool works. This is a common issue with systems that use in-memory resources while they are running, but then get stalled and written to disk while waiting for something to happen. This makes much more sense that having a process continue to consume memory for days (or weeks or forever) while waiting for a user to take action, and then forgetting everything when the system gets recycled.

                          Regarding your functions, you have two options:
                          - First, you can just create a start variable for each function (or for all your custom functions) and put the function definition within it so it gets saved. Then, the function can be called for anything after that. I do this a lot
                          - Second, if it's a standard function that you call from multiple flows, you can put it in the pflow_user.js file on your servers (development client and application servers) in the same place as the delivered pflow.js file. Then the function is available just as all the delivered functions are. Just be sure to format the file EXACTLY like the delivered pflow.js file.

                          This is frustrating when you first start using IPA, but once you understand what it is doing and remember to store your variables before the process stalls, it really isn't an issue.

                          That said, it is frustrating that the UserAction node expects the actorID to be the same as the loginID (which is not the case in our world) so if I'm testing in Designer and approve/return/reject it doesn't recognize me. Not a biggie now that I know, but still annoying.
                          Kelly Meade
                          J. R. Simplot Company
                          Boise, ID
                          GeoffTSJY
                          Basic Member
                          Posts: 16
                          Basic Member
                            Hi @Woozy,

                            I was not aware that you could store functions in the start node. There is nothing in the documentation that I can find on that. I would have thought that it would store them as strings because if you do a .toSource() you can see that anything done in their variable assignment section is actually cast as "new string()", where string is the type of variable you selected.

                            
                            Activity started: Assign4940  (Run Id: 2)
                            Evaluating JavaScript expression var a = 1;; to value undefined
                            t1 = (new Number(1)) //I had put in a.toSource()
                             


                            I'll have to play with storing functions that way. Thank you for the suggestion.

                            About my complaints, let me clarify. I understand completely why you need to suspend the process. My complaints are more for the lack of tools to provide saving of states of objects. I realize that I can do things on my own to save off states. But the biggest complaint and the most frustrating part is with the testing problem that I described. If it is going to restore only certain parts of in-memory storage, then the desktop simulation should simulate that. That should not be hard. Deallocate everything and only reallocate what is in the start node, etc... That's my real complaint. I shouldn't be able to do tests that look like they are working only to realize that it is not when I go to deploy. I understand that this is one of those things that you get bit with once but still...

                            If you spend even just a few minutes evaluating even free, open source BPM designers, you'll see that Infor/Lawson are WAY behind the curve on features and user experience. So there really is no excuse for having such horrible products. I know it's a small thing, but one great indicator that the designers at Infor have no idea what coding is about: they don't even use fixed-width fonts in their editor! Not to mention that they don't call their repaint methods (basic Java UI knowledge) when they destroy their graphics and so you end up with lots of screwy graphics glitches. And have you seen the way they structure their log files? Totally inconsistent and haphazard...

                            I do appreciate your tips, though! Thanks!
                            Peter O
                            Veteran Member
                            Posts: 69
                            Veteran Member

                              Geoff Like everything with IPA ( which woozy touched on) you need to know it's quirks.

                              IPDesigner/IPA has warts, but it's a very powerful solution when you have enough time to figure out those warts and how to work around them. It's a love/hate relationship sometimes.

                              I use E4X & XML modification extensively and I even do some modification of action request XML-- it can be useful, but it has it's limits, especially in the newer versions. Infor is aware of the issues with E4X and I have no doubt they will be fixing them eventually.

                              If you use XML/E4X extensively for managing connections with disparate systems, it can work fine IF *IF* IFFFFFFFFFF you first experiment with how and when IPA does NOT follow the specification and where it DOES follow the spec. Sometimes, when you discover how IPA needs to do something, it makes sense in an "IPA way" and you'll get a feel for that.

                              It's hard for me to accurately describe how you'll eventually understand how the tool works and it's limitations, but I can only say it will be a similar experience to learning any general programming language. You'll have parts where you go "Why in the heck would anything ever do it that way?" and then you'll eventually see some logic in it as you move on.

                               

                              Also - have you tried defining your JS functions in the start node? I'll check and see if that works to hold the expression..

                               

                               

                              Peter O
                              Veteran Member
                              Posts: 69
                              Veteran Member

                                Ah Woozy,

                                 

                                you beat me to it, I didn't see your response to put it in the start node!

                                Woozy - you always bring an air of calm common sense to the discussion -- thanks for that

                                 

                                ~Peter

                                 

                                GeoffTSJY
                                Basic Member
                                Posts: 16
                                Basic Member
                                  Sweet! thanks guys! I stored a function in the start node as a string and it didn't work but as a xml type it does. I'll give it a whirl.

                                  I figured you'd be able to get great stuff to happen with this tool as it is ultimately javascript and XML. But sometimes I think I'd do better with just a notepad and nodeJS. I wish there was a wiki for how to get powerful, organized, advanced stuff to happen within this loony bin of a tool. thanks again!
                                  Peter O
                                  Veteran Member
                                  Posts: 69
                                  Veteran Member

                                     

                                    If you spend even just a few minutes evaluating even free, open source BPM designers, you'll see that Infor/Lawson are WAY behind the curve on features and user experience. So there really is no excuse for having such horrible products. I know it's a small thing, but one great indicator that the designers at Infor have no idea what coding is about: they don't even use fixed-width fonts in their editor! Not to mention that they don't call their repaint methods (basic Java UI knowledge) when they destroy their graphics and so you end up with lots of screwy graphics glitches. And have you seen the way they structure their log files? Totally inconsistent and haphazard...

                                     

                                    Amen to everything you just said.

                                    Peter O
                                    Veteran Member
                                    Posts: 69
                                    Veteran Member

                                      Sweet! thanks guys! I stored a function in the start node as a string and it didn't work but as a xml type it does. I'll give it a whirl.

                                      I figured you'd be able to get great stuff to happen with this tool as it is ultimately javascript and XML. But sometimes I think I'd do better with just a notepad and nodeJS. I wish there was a wiki for how to get powerful, organized, advanced stuff to happen within this loony bin of a tool. thanks again!

                                      Ask and ye shall receive. I'll let you know when I get the wiki started.

                                      GeoffTSJY
                                      Basic Member
                                      Posts: 16
                                      Basic Member
                                        @ Peter

                                        Wow thanks! I have known about this site for a while. I never posted as I assumed it was a niche group that was likely to be less active. I wish I'd started sooner. I can't believe how quickly and effectively this community helped! You guys are great.
                                        Woozy
                                        Veteran Member
                                        Posts: 709
                                        Veteran Member
                                          Thanks Peter O and GeoffTSJY - this has been a good discussion.

                                          By the way, I have regular discussions with several of the developers and development managers at Infor (Andrew Lepitzky, Dan Miller, Parker Erickson, James J) - several of them have spent time on-site with us - and they are generally very open to hearing about ways their tools and applications can be improved. They are also very often aware of the areas where they are lacking.   Many times, they respond with "You're trying to do what?  I've never thought of that.  I'll make a note to talk to XYZ about that when I get back".
                                            
                                          However, in this "agile" world we're living in, they are being directed to focus on development of a) features that customers are asking for and b) features that are used (or will be used) by significant numbers of customers, and c) features they can sell. Unfortunately, development tools don't fall into a or c, and the 12 of us who are on the cutting-edge of Pflow/IPA development (ok, it's probably more than that...) just don't fall into any of those categories.

                                          I will say that the tool has significantly improved in the past three years. However, I'll continue to submit enhancement requests (as ugly as that process is) and bug the heck out of the Infor development folks every opportunity I have.

                                          That said, I'm going back to work on my current development task with S3 COBOL...(groan)

                                          Kelly
                                          Kelly Meade
                                          J. R. Simplot Company
                                          Boise, ID
                                          GeoffTSJY
                                          Basic Member
                                          Posts: 16
                                          Basic Member
                                            @woozy, good to know. thanks!
                                            mikeP
                                            Veteran Member
                                            Posts: 151
                                            Veteran Member
                                              Woozy or PeterO,

                                              I've been playing with trying to store a function in a start variable, and I need a hint. Say I have a function:

                                              Function MyFunc(parm1) {
                                              [some code]
                                              return myvalue
                                              }

                                              How would that go into a start variable? Would MyFunc be the variable name, and just the code with the return value go in the variable value?

                                              Thanks,
                                              GeoffTSJY
                                              Basic Member
                                              Posts: 16
                                              Basic Member
                                                I did it this way:

                                                        

                                                 

                                                  


                                                Where Assign contains:

                                                 

                                                Output:

                                                 

                                                This shows that it it performed as pass by value and that your original value in myInt isn't changed. So if you actually wanted to change the value, you would have to call:

                                                myInt = addOne(myInt);

                                                 

                                                This has been working for me. I hope it works for you too. If you want to see some much more complex examples of how I've used functions in my flows, see:  https://www.lawsonguru.co...ions-in-processflow/

                                                 

                                                Woozy
                                                Veteran Member
                                                Posts: 709
                                                Veteran Member
                                                  Yep, that's what I would do to if I needed the function to be available across breaks (i.e. useractions). If that isn't a requirement, then you can put the function in a javascript assign (not attached to a start variable). The other option is to put it in the pflow_user.js file on the server (and designer client) so it is available to all processes.

                                                  Good luck!

                                                  Kelly Meade
                                                  J. R. Simplot Company
                                                  Boise, ID
                                                  mikeP
                                                  Veteran Member
                                                  Posts: 151
                                                  Veteran Member
                                                    Thanks guys, it's working now. That was exactly the info I needed, how to name it, and how to call it.
                                                    You are not authorized to post a reply.
                                                    Page 1 of 212 > >>