Set textbox value on Is Edit Mode


Badge +7

When a form is in edit mode, I would like to set the value of one of my fields (a text box). This does not error out, but it doesn't update the field either. What would be a better way of accomplishing this?

217914_pastedImage_2.png


11 replies

Userlevel 5
Badge +14

Out of curiosity, what exactly are you trying to accomplish by doing this? 

If anything was already typed there, it would be erased and saved over with your default message anytime the Form was Edited, and that seems like a strange way for any type of input to behave. 


Badge +7

Yes, you are right! It's actually a field for me to use in the workflow. I want to use a choice field but was getting errors with that, so I was playing with it as a plain old textbox (textbox will work fine for my purposes since I'll be populating the field with what I need). The user won't edit the information. I want the value for the workflow and can't identify an existing field on the form that I could use instead. Thank you for your reply.

Badge +7

Also, the logic will be a little more involved than just "is edit mode", but I want to get that part working before I add in a nested If.

Userlevel 5
Badge +14

So you have an Item Form that you want to contain a Control that a user cannot interact with, which will be used / queried to relay *some* type of information to a Workflow? yes? 

If that's the case, maybe a Calculated Value Control would be better suited for what it is you're doing. 

Based on your last reply I'm not sure if you still want help with this topic or if you plan on going about this a different a way, but no matter, if you can describe just a bit more about the problem I'm sure that it can be solved.

Badge +7

Thank you so much.

I sometimes forget about the calculated field option. That might work better. I will post what I end up doing. 

What I really need is a way to put a few lines of code in a Form Load event cry.png

Userlevel 5
Badge +14

No Problem! 

We're all here to help one another, so I think that if you were to describe exactly what it is you're trying to do, we can work together and probably get it solved. 

What exactly is it that you'd like to happen? 

Badge +7

I got myself into an infinite loop by calling a workflow from a workflow that is started when an item is edited. If I could set some conditions based on the form and what's going on, I could use that in the workflow to prevent having workflow A call workflow B which then triggers workflow A. I think the whole thing could be solved by putting it all in one longer workflow but it seems (seemed?) more manageable to break it into two pieces since there's a fair amount going on in each one (parsing a repeating section is done in one workflow by itself).

confused.png

Userlevel 5
Badge +14

Well. Let's look at what's going on with those workflows and why they would be set up in such a way that it's causing them to loop. 


What is Workflow (A) doing and how it set to run? 

What is Workflow (B) doing? 

Badge +7

Hello again.

Workflow A is triggered when a list item is edited. It calls Workflow B to get 3 values from a repeating data control (three fields from the most recent entry in the repeater), and it updates the list item with these three values so I can easily use them elsewhere (for example, the users have a list view on a site page that shows the current status and location of their items - this information is pulled from the repeating data control). When Workflow B is done, I return to Workflow A and do various whatnots - email notifications, steps that are taken if an item is removed from inventory or sent out for repair.

The trouble is that Workflow B, by updating the list, is causing Workflow A (triggered by an edit) to begin again. So I was thinking if I had a value on the form, for my admin use only, I could use it as a flag at the top of Workflow A. If flag = somevalue, then go ahead and run this workflow. Otherwise, exit. I am totally open to doing it some other way. At the time it seemed like such a simple route to go.

Thank you.

Userlevel 5
Badge +14

It might be useful to see this form eventually, but could one way of preventing be to simply set up a more specific Start Condition that would only run if the Column Field containing the XML for that Repeating Section didn't Equal the previous value of that same Field? 

If I'm storing some Repeating Section XML inside of a Multi-Line Text Column Field called [ProductionInfoXML], then perhaps the Condition for starting the workflow would look something like: 

217952_pastedImage_1.png

---------------------------

There is of course a different solution to this, which I think would be even more simple for your to pull off. Using this guide: Nintex Forms - Save or Submit - Vadim Tabakman 

Ignoring the part about using both the Save and the 'Save and Submit' (unless you actually are using both...), you can see that it is simple enough to attach a Save and Submit button to a Column Field (either a Single Line Text, or Number). Doing so, you could, upon Submitting the form, change that value from the default of, let's say: 0, to 1. 

In Workflow A, you setup the start condition to only start if that value has been set to 1 (meaning that the Form has been Submitted), however, you FIRST action in Workflow A can be to SET THAT VALUE BACK TO 0, meaning that no matter what changes happen beyond that, they will NOT invoke the Workflow again because the value is no longer 1! 

Clear as mud? yeah? 

Badge +7

I love it!!

Reply