Force Update Read-only fields

I have a use case where I have applied the following to several fields that allow Staff to have "Edit" functionality while masking or disabling the view for Guests so their experience is "Read-only".

The problem is that I want the guest to see the changes, but not have the ability to change them.

//For staff
fd.field('SomeField').disabled=false; 

//For guest
fd.field('SomeField').disabled=true;

What might I do to make this happen? Right now, the Guest view does not reflect the updated changes made by Staff.

Dear @shedev,
When should the updates happen? If fields need to be updated when the form opens, you can just set fields as read-only in the editor:
image

You can also create a separate Form Set for staff where the fields are editable - Personalize SharePoint forms based on Azure AD (Microsoft 365) or SharePoint groups in Plumsail Forms — SharePoint forms

Hello, Nikita.

I have a single form set in place with New, Edit, and Display. Are you suggesting that I can create an additional set – a second New, Edit, and Display set? I am also still using the desktop Plumsail Forms Designer; I am not ready to upgrade to the browser-based version.

Scenario

  • Staff (Licensed 365/EntraID Member) creates an item
  • Staff populates key fields
  • Staff assigns to EntraID Guest
  • Guest is notified of pending work
  • Guest populates and/or edits key fields
  • Guest clicks custom button which notifies Staff of their pending work

In the form are many fields, as you’d expect; only a few of which need to be Read-only for the Guest and simultaneously Edit-abled for Staff. I used the JS editor to apply fd.field(field).disabled=true; for guests and fd.field(field).disabled=false; for staff to the fields in question based on logged in user. This works beautifully to block guests from editing, but when staff makes any changes to the form, the fields do not update/refresh when a Guest opens the item later.


I have a workaround that I have put in place and is working, but I think I am missing a key piece and defer to your wisdom. An older workflow I implemented looked like a "leap frog" or, better yet, a dumpster fire scenario. It still makes me cringe looking at it. Messy and way too many lines I think.

fd.spRendered(function() {

    fd.field('SharePointLookupColumn').$on('change', function() {
    	fd.control('PlumsailPlainTextControl').text = fd.field('SharePointLookupColumn').value.LookupValue;
        fd.field('SharePointTextColumn1').value = fd.control('PlumsailPlainTextControl').text;
        fd.field('SharePointTextColumn2').value = fd.control('PlumsailPlainTextControl').text;
    });
    
});

The read-only issue catches me all the time and I think I have forgotten lessons learned but searching the community posts, I can't quite find where this has been done elegantly. Thank you as always for your thoughts.

Dear @shedev,
The changes not being visible are strange, perhaps the cache is the issue? Try adding the following code line to JavaScript editor:

localStorage.clear();

However, designing form sets is the default recommended option for such cases, they would be almost identical to the ones you have and would be easy to maintain. Alternatively, you can hide these fields entirely with:

fd.field('Title').hidden = true;

And then replace them with text controls, where field names are placed in square brackets, like so:
Title: [Title]

These would be automatically replaced with latest value, like described here - Plain Text — SharePoint forms

We HIGHLY recommend updating to the latest version of the editor though, it's still a desktop application, and the v2 editor is no longer supported, containing multiple bugs that have been fixed in the latest version of the editor. It can always be downloaded here - Plumsail Account

1 Like