Restrict submission of catalog item if the url in the help text is not clicked

RanjanRP
Tera Contributor

Is there a way to prevent submitting a catalog item unless the user clicks a URL in the help text?

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@RanjanRP 

You can have this approach

1) create a hidden checkbox type variable and place it at the end of catalog form and hide it using UI policy

2) use variable of type Custom and create a widget to show that URL, in HTML of that anchor tag add onclick even and then update that hidden checkbox as true once link is clicked.

3) use onSubmit catalog client script and see if checkbox is true, if yes then allow submission, if not then stop submission

This is the widget syntax to set the variable from widget client controller

api.controller = function($scope) {

$scope.page.g_form.setValue('hiddenVariable', true);


});

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@RanjanRP 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

Hi Kamil,

Thanks for you response, can you please elaborate the solution.

 

 

 

@RanjanRP I created a quick draft:

KamilT_0-1752666961279.png

this is how would it look like and if it is not yes, cannot continue...

 

 

EDIT: or alternatively in combination with label, mandatory to click this:

KamilT_0-1752667384486.png

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@RanjanRP and the label annotation is HTML 😄 so you can use it as you want...

KamilT_0-1752667597127.png

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Pranesh072
Mega Sage
Mega Sage

You can use the custom variable type and create new widget or macro which can handle this logic.

Ankur Bawiskar
Tera Patron
Tera Patron

@RanjanRP 

You can have this approach

1) create a hidden checkbox type variable and place it at the end of catalog form and hide it using UI policy

2) use variable of type Custom and create a widget to show that URL, in HTML of that anchor tag add onclick even and then update that hidden checkbox as true once link is clicked.

3) use onSubmit catalog client script and see if checkbox is true, if yes then allow submission, if not then stop submission

This is the widget syntax to set the variable from widget client controller

api.controller = function($scope) {

$scope.page.g_form.setValue('hiddenVariable', true);


});

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader