For a new app on version 8.1, I'm trying to lock up all fields on a page based on the record condition. I have a Locked by field on the record and if the field is empty or different than the current user, I want to make the whole page read only.
I was able to do that on previous versions by adding some code to the page. At high level I needed to add the IsModelItemsEnabled attribute and have a "setCardLockoutStatus" method that triggers when the UsrLockedBy field changes. I also need to do a merge operation on the CardContentWrapper to set the generator value to DisableControlsGenerator.generatePartial.
What page code I need to write to accomplish something similar on 8.1? Or can that be accomplished now with no code?
The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages.
However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:
The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages.
However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:
Thanks Natalia. I do have a lot of fields on the page so I was looking for something like the CompleteCardLockout feature, but business rule will do. Do you know if there are any plans to have that feature on the freedom UI version? It takes some maintenance to keep those rules updated every time fields are added to the page.
Is there a way to block adding attachments and notes on any section. I want to do this on the Lead and Opportunity according to the Stage. If the Stage is Inactive. I won't be able to add any attachments and notes.
Here is an example on how to achieve this in opportunity page:
1) Add the boolean column in the Opportunity edit page. The code for the column should be "UsrInactiveStatus". Save this change.
2) Create a business process that will set the value to true or false in case the status of the opportunity is either active or inactive (use "record modified" trigger signal which triggers on the opportunity modification in the "Stage" column (be careful not to cycle the business process, it's as a must to select the "Stage" column as a column that triggers the process)). Also at the end of the process execution it should refresh the current opporutnity page (use this marketplace app to achive this task).
3) Create a replacing view model for the "FileDetailV2" module and add the following code to the module:
define("FileDetailV2", [], function(){return{
mixins:{},
properties:{},
attributes:{},
messages:{},
methods:{
upload: function(config, callback){
var isOpportunityAttachment = config.entitySchemaName=="OpportunityFile";
var canUploadFile =this.getIsCurrentStatusActive();if(isOpportunityAttachment && canUploadFile){this.callParent(arguments);}else{
Terrasoft.showErrorMessage("Current status is inactive, uploading restricted");}},
getIsCurrentStatusActive: function(){
var columnsValuesObject =this.sandbox.publish("GetColumnsValues", ["UsrInactiveStatus"], [this.sandbox.id])||{};return columnsValuesObject.UsrInactiveStatus;},
},
diff:/**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/};});
4) Refresh the page and chek the result.
As a result in case the value for the UsrInactiveStatus column is false, the upload method will return an error popup stating that the current stage is inactive and uploading files is restricted. You can also check it by displaying the UsrInactiveStatus checkbox on the page and enabling\disabling it (an opportunity record must be saved each time you enable to disable the checkbox).
When user opens the page from a Section (e.g. Orders), it works correctly - all fields and details are locked.
But when user opens the same page from a detail (e.g. Account/History/Orders) - all fields and details are not locked, so DisableControlsGenerator doesn't work
I've run into a small test by displaying the configuration items detail on the contact page and by applying fields locking on the configuration item page. When opening the configuration item from the detail located on the contact page the fields are locked. So the issue is that the conditions that you use to lock the page are not working as they should.
I was also able to reproduce it for Contracts, will contact our R&D department for clarifications and return to you once I receive any feedback from them.
I would like to know if I can make a stage of a DCM lifecycle non editable by using business rule. When the stage is inactive, I want the owner to not be able to change it.
For these purposes, it is recommended to use [Pre-configured page] process element instead of Auto-generated page as pre-configured page is much more easier to set up.