Activity Cross field validation

Hi,

I am wanting to achieve the following:

1. Activity Status = Completed AND Category = To Do

2. Upon save, field validation occurs to display a pop-up (or similar) asking user to set a correct Category value

 

This is to improve data analytics for the category data, as currently my users are not changing this value when an activity is completed. A category of To Do, does not make sense if the activity is now complete you see.

I found this post - https://community.creatio.com/questions/messagebox-display-popup-box-requesting-user-confirm-some-situation, but I do not know how to complete this for the correct actions i.e. Only when the above condition is in place and click Yes means continue and submit the form or No means close window and allow user to change Category value.

Thanks for any help.

 

Like 0

Like

2 comments
Best reply

Hello Mark, 



Please refer to the following code in order to add the functionality requested:

 

define("ActivityPageV2", [], function() {
    return {
        entitySchemaName: "Activity",
        messages: {
        },
        methods: {
            save: function() {
                var IsToDoCategory = this.get("ActivityCategory") && 
                    this.get("ActivityCategory").value === "f51c4643-58e6-df11-971b-001d60e938c6";
                var IsCompletedStatus = this.get("Status") && 
                    this.get("Status").value === "4bdbb88f-58e6-df11-971b-001d60e938c6";
                if (IsCompletedStatus && IsToDoCategory) {
                    this.showConfirmationDialog("Please, set proper category!");
                } else {
                    this.callParent(arguments);
                }
            }
        },
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
    };



Kind regards,

Roman

Hello Mark, 



Please refer to the following code in order to add the functionality requested:

 

define("ActivityPageV2", [], function() {
    return {
        entitySchemaName: "Activity",
        messages: {
        },
        methods: {
            save: function() {
                var IsToDoCategory = this.get("ActivityCategory") && 
                    this.get("ActivityCategory").value === "f51c4643-58e6-df11-971b-001d60e938c6";
                var IsCompletedStatus = this.get("Status") && 
                    this.get("Status").value === "4bdbb88f-58e6-df11-971b-001d60e938c6";
                if (IsCompletedStatus && IsToDoCategory) {
                    this.showConfirmationDialog("Please, set proper category!");
                } else {
                    this.callParent(arguments);
                }
            }
        },
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
    };



Kind regards,

Roman

Thanks for your reply Roman, this worked beautifully.

 

I am interested in the GUID values you have in the code, is there any meaning to these values?

 

Note for others, the code above needs the && replaced with &&

Show all comments