Home › Forums › Modern DFFS › Set Field Value Using Rules on Disp Form
- This topic has 3 replies, 2 voices, and was last updated 1 week, 6 days ago by
Alexander Bautz.
-
AuthorPosts
-
-
June 1, 2026 at 15:55 #39169
I feel like I’m probably missing something super simple. I would like to change field value (a status showing the item as unread/read), when the item is opened in either view or edit mode. In edit mode, I created a rule that is triggered by the form loading. However, when I tried to replicate the rule on disp mode, there is no “set field value” option.
Is this something that would need to use a custom JS function instead of a rule?
Thanks!
Attachments:
-
June 1, 2026 at 20:48 #39171
Dispform is by default read-only and there is no “save button” so setFieldValue won’t work since it requires the item to be saved. You can however use custom js to programmatically update the item as soon as someone opens it in dispform.
You must get the DFFS_Utils file from this thread (an attachment at the bottom): https://spjsblog.com/forums/topic/custom-js-examples/#post-36150
Rename the file to DFFS_Utils.js and save it in for example SiteAssets in your site. Link to it from your Custom JS tab (in the field “Load external JS files”). Now you can add the following to your Custom JS:
window.dffs_ready = async function () { const status = getFieldValue('Status'); if (status === 'Unread') { const res = await dffs_updateListItem({ baseUrl: _spPageContextInfo.webServerRelativeUrl, rootFolder: _spPageContextInfo.listUrl.split('/').pop(), itemId: getFieldValue('ID'), data: { Status: 'Read' } }); // console.log(res); } };Alexander
-
June 1, 2026 at 21:42 #39172
Thank you! I went to try this solution and it seems like the Custom JS field is not loading on either of our sites where we have DFFS installed. Not sure if this might be an issue on our tenant or if it’s a DFFS issue?
Attachments:
-
June 1, 2026 at 22:21 #39174
I suspect that you are using an older version (pre v1.2.23) and the new CSP enforcement from Microsoft blocks some functionality of the older code-editor. Check your DFFS version and update to the latest version and it should work.
Check the changelog here: https://spjsworks.com/changelog/
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.

