Hello!

 

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.

 

Thank you!

Like 0

Like

1 comments

 Hello,

 

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).

Show all comments

Hi community,



I want to modify the value of the field "Notes" from a process but the field does not appear in the block "Modify data". We have checked the object "Case" and the field does exist. Hope you can tell me the reason.



Thank you in advance!

Like 0

Like

0 comments
Show all comments