Save as Draft item in SharePoint List

Hi Team,
I have a requirement; user should save as a draft in Plumsail form and later should be able to submit it. When the form submission, there is a Power automation flow to be fired, so until submit the form data should temporally save in the list. is there are way to achieve this using Plumsail forms ?,
Another request, is there a way to add new submit button not the form and default save button rename as save as draft?
Once save click it should save only as a draft. Once submit clicks it should submit and start the flow. Please help me on this

Hello @madhawa.rajapaksha,

'As a draft' you mean that the flow should not be triggered when the item is saved as a draft. Is that right?

If so, you can create a new column, e.g. Draft and add the field to the form.

You can hide the field on the form using this code:

fd.spRendered(function() {
    //hide field on form load
    $(fd.field('Draft').$parent.$el).hide();
});

And add two buttons to the form: Save as draft and Submit. The field value of the Draft field will change on button click and define whether the item is saved as a draft or not.

The code for the draft button:

fd.field('Draft').value = true;
//save the form
return fd.save();

And the code for the submit button:

fd.field('Draft').value = false;
//save the form
return fd.save();

Finally, in the flow you need to add a condition before all steps to check whether the item is a draft or not.

Hope this instructions helps!

1 Like

Hi @mnikitina Thank you for the quick response. Yes, I mean i don't want to trigger flow until item submit. Let me try it and get back to you.

1 Like

Hi @mnikitina,
Iā€™m new to Plumsail. So let me elaborate my requirement which I suppose to complete. Could you please help me on this?

  • Need to hide default tool bar Save and Close buttons.
  • Need to add 4 buttons for Save & Finish Later, Edit, Submit and Cancel
  • In new form loads user should view Save & Finish Later, Submit and Cancel buttons and if user clicks on Save & Finish Later button item should save to list.
  • After some time, user should be able to edit the same item, at that time when user open the form it should show Edit and Cancel button.
  • When user click Edit button, form should allow to edit fields and need to view all 3 buttons as I mentioned step 3.
  • If user clicks again Save & Finish Later button modifications should save to list.
  • If user clicks on Submit need to trigger a flow.
  • Later, if a user open submitted form, it should not allow to edit, it means Edit button should hide for submitted items.

This is the task which I need to complete, so could you please provide me solution with sample code to complete this task?

And one more question: when using Plumsail forms for SharePoint online is it essential to create the list columns using custom content types? if yes, what is the advantage of using content types for Plumsail forms?

Thanks,
Madhawa

Hello @madhawa.rajapaksha,

You can modify the add, remove and modify buttons in the toolbar using the fd.toolbar property. For instance, you can change the default Save button text and behavior:

fd.spRendered(function(){
    //change the Save button text
    fd.toolbar.buttons[0].text = "Submit"
    
    //change the Save button function
    fd.toolbar.buttons[0].click = function(){
      fd.field('Draft').value = true;
      fd.save();
    }
});

You can modify the toolbar for the New, Edit, and Display forms. Please find more information in our documentation here:

Please see my previous post describing how to create Submit button that triggers a flow.

You can remove the Edit button on the display form if the form is submitted. And if a user opens an edit form from a list view, redirect to the Display form. Use the code below on the edit form.

fd.spRendered(function(vue) {
    //check if an item is submitted
    if(fd.field('Draft').value == false) {
        var listId = fd.spFormCtx.ListAttributes.Id
        var itemId = fd.itemId;

        //replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
        //PageType=4 means Display Form
        var URL =
        "https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=4&ListId="
        + listId + "&ID=" + itemId;
        
        //redirect to the display form
        window.locatin.href = URL;
    }
});
1 Like

You can create columns for a default content type only and design forms for a default content type.

1 Like

Thank you very much @mnikitina. Appreciate your quick responce....!!!

1 Like