How to make variables mandatory on an SCTASK only AFTER the assigned-to is not empty?

Roberta B
Mega Guru

Hello,

I have 5 mandatory variables that only the tech should fill in once the auto-generated SCTASK is assigned to the group.

However, the SCTASK cannot be assigned-to a tech until all mandatory fields are completed.   Any ideas how to make those variables mandatory AFTER the assigned-to is not empty? 

 

Thank you!

1 ACCEPTED SOLUTION

Roberta B
Mega Guru

@AshishKM  and @-O-  -

 

I appreciate your response.

 

I ended up having to create the following new Client Script just for this one catalog item to meet our needs, as a Catalog UI Policy script did not work:

 
RobertaB_0-1698764759128.png

 

View solution in original post

8 REPLIES 8

AshishKM
Kilo Patron
Kilo Patron

Hi @Roberta B ,

The auto generated task ( via workflow ) should assign to some assignment group ( Tech Team ). After the SCTASK's mandatory variables & assigne_to can be update together.

 

If the above solution not works for you then the SCTASK's mandatory variable should not mandatory until open/or/work in progress state, it should be mandatory when someone trying to close it. 

 

You can write catalog client script and check the SCTASK status [ onSubmit ] if the new state = close complete or close incomplete and those mandatory variables are empty then throw the alert.

replace the "yourVariable" with the actual variable name and test. 

function onSubmit() {
    //Type appropriate comment here, and begin script below
if (g_form.getValue('state') == '3'){
	
	if (g_form.getValue("yourVariable") == "" ) {
            //alert("Please Select - Send task to Indirect Procurement Yes or No");
			g_form.addErrorMessage('Please Fill the - Mandatory variable"');
            return false;
        }
    }
}

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Roberta B
Mega Guru

Hello @AshishKM -

 

I do have the Assignment group being set in the flow.  I prefer to make the Assigned-to field be able to select a tech name in the Flow (vs. creating a Client Script), if the variables are mandatory in the SCTASK. However, how do I do that?

 

Here is that section of the flow:

RobertaB_0-1698698958013.png

 

Hi @Roberta B ,

 

Assignment Group is fixed for that catalog item but "Assigned To"  can any one from the same group which is SCTASK level update, however you can set the "Assigned To" variable with some specific user then all such SCTASK will assigned ( default ) to same person. 

 

Also, there will some email notification when a SCTASK is assigned to any group , that email will not trigger because of non-empty "Assigned To" 

You can add "Assigned To" via , "Add field value" button, if you want to do that.

 

AshishKMishra_0-1698713906284.png

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

-O-
Kilo Patron
Kilo Patron

You could configure a Decision Table an use its output as input for an addition field (Assigned to) under input named Fields.