when Opened by and logged in user are not same user should not submit the catalog form.

Vinod S Patil
Tera Contributor

Hello Team

My requirement is opened by and logged in user are not same, catalog item should not submit the request and it should show some error.

This has to be done using on submit client script. Please help me.
@Dr Atul G- LNG 
@Anil Lande 
@Ankur Bawiskar 

1 ACCEPTED SOLUTION

Aniket Chavan
Tera Sage
Tera Sage

Hello @Vinod S Patil ,

I didn't understand the term you referred to as 'opened By' because, as @Maik Skoddow mentioned, it will be populated once the item has been submitted.

So If you're referring to the variable named "opened by" in your form and want to ensure it's the same as the logged-in user, you can achieve this through an onSubmit client script. Alternatively, you might consider making the variable read-only and auto-populating it based on the logged-in user.

Here's an example of an onSubmit client script for validation:

 

function onSubmit() {
    var loggedinUser = g_user.userID;
    var openedBy = g_form.getValue('opened_by');

    if (openedBy == loggedinUser) {
        //g_form.showFieldMsg('opened_by', 'The Opened By user is the same as the Logged In user.', 'info');
        return true;
    } else {
        alert("Please make sure that Opened By and Logged In user should be the same.");
        return false;
    }
}

 


Also you can refer the below link as well:

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,
Aniket

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Vinod S Patil 

 

experts are already on it.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************