save as draft not setting button value

  • 15 April 2016
  • 9 replies
  • 2 views

Badge +8

Good Day,


I am using the Tips on how to emulate draft functionality in a list  functionality and when I click the buttons [save as draft] / [save and submit] it is not setting the value yes/no like the direction say it should be.  I have the confirmation message returning the values and it is blank...

I tried defaulting the value in the list to 'yes' basically saying it is in the draft state until the other button is selected for submit, but it doesn't seem to want to reset to 'no'.

Any suggestions are appreciates, thank,

Jennifer


9 replies

Userlevel 5
Badge +12

Hello,


I see you have the button connected to a field called "draft", two questions:

1) What type of field is draft (text, yes/no...)?

2) In the backing list, do you see the value "no" being set in the draft column upon clicking the button?

Thanks

Badge +8

Thanks for the reply. It is a text field and yes, when you after you click submit it sets the value in the column

Userlevel 5
Badge +12

Well, the confirmation will display blank because "draft" is a column in the list, but isn't populated until after the item has been created.  I suspect that if you open a form where the draft is already set to a value (meaning not a new item) then you might get a value to popup in your confirmation message.   Are you just using the confirmation for testing sake, because the way it is currently setup you could just as well hardcode a value into it, since the value returned by that button is hardcoded to No.

From the help menu you can see that:

  • Confirmation message: When the user clicks on the button during runtime, they will be prompted with this message prior to the buttons functionality being processed.

This means that the confirmation fires before any values are set in the item itself.  That's why its ending up blank.

Badge +8

I was using the confirmation message to test if the values [yes/no] were set on submission.  It doesn't seem to work on publish or testing either.  What happens is the value isn't saved until submit so any form rules that would need to run on those values never get fired. 

For example:  isNullOrEmpty(Title) && Draft == "No" | Wouldn't work because it doesn't set the value, then submit, it submits and then sets the value.

Thanks,

Jennifer

Badge +8

I just saw someone else trying to do the same thing and was told it was not possible. Using Validation rule to enforce fields depending on a button .  Does anyone else have any suggestions besides using JS?  I want to stick with as little JS as possible.

Thanks,
Jennifer

Userlevel 5
Badge +12

Exactly - when using item properties they are always "after the form has been submitted" so when trying to create rules its generally better to rely on Named Controls within the form.  It is pretty easy to create "draft" like functionality though using a workflow.   Say you have two buttons on the form:

1) Save - returns Draft value of Yes

2) Submit - returns Draft value of No

You can stop processing the data and exit the workflow based on the Draft value.   If you see Draft is yes, then terminate the workflow or have it wait until Draft equals no. 

Badge +8

But I don't want to execute the workflow until the validation is correct on the form. So for instance, the user can 'save' the form without issues, but because the button doesn't validate until the form has been submitted it won't fire the workflow rules requiring the fields to be complete.

Thanks for the info!

Badge +4

Hello Jennifer.  Did you ever come up with a solution for this?

Thanks--

Userlevel 5
Badge +12

Looks like this post got lost in the weeds somewhere along the line and never finalized.  ‌ did you have a similar requirement?  Might be good to start a new post on it so it'll get more attention (if you haven't already).

Reply