- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2024 11:15 PM
Hi all!
I'm looking for a way to check if a variable is read-only on client side.
Any idea how that can be done?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 03:50 AM
Actually, it's a bit complicated logic which we have put in place.
We have a review feature for non-fulfillers, on the same form which is used to submit the request.
For your information, we have a client script (CS3) available for setting the variable values only(not making read-only), which triggers on change of var_a, other than that of var_e.
For review feature to work, we are only setting the value in var_a , so it can trigger the already developed client script.
So let me summarize this:
onLoad (CS1) -> set the value in var_a -> triggers the (CS3) -> sets the value in all variables, including var_e -> triggers the (CS2) -> sets the variables read-only, except var_e and clears the value.
Now coming to your suggestion;
- CS2 & CS3 can't be merged as it would dissolve the functionality of CS3, which is required independent for other use cases (where the variables shouldn't be read-only).
I'm thinking not to reuse this feature and re-build the functionality once again in the CS1 itself, and exclude var_e setting and resetting feature there.
Thanks for your help!
Regards,
Aman Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 02:27 AM
why to have 2 CS?
your 2nd CS is on running on last variable just to make variables read-only except that var_e
So please combine both logic in 1 CS i.e. onChange of your variable
don't set the var_e and don't make it readonly
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 03:50 AM
Actually, it's a bit complicated logic which we have put in place.
We have a review feature for non-fulfillers, on the same form which is used to submit the request.
For your information, we have a client script (CS3) available for setting the variable values only(not making read-only), which triggers on change of var_a, other than that of var_e.
For review feature to work, we are only setting the value in var_a , so it can trigger the already developed client script.
So let me summarize this:
onLoad (CS1) -> set the value in var_a -> triggers the (CS3) -> sets the value in all variables, including var_e -> triggers the (CS2) -> sets the variables read-only, except var_e and clears the value.
Now coming to your suggestion;
- CS2 & CS3 can't be merged as it would dissolve the functionality of CS3, which is required independent for other use cases (where the variables shouldn't be read-only).
I'm thinking not to reuse this feature and re-build the functionality once again in the CS1 itself, and exclude var_e setting and resetting feature there.
Thanks for your help!
Regards,
Aman Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2024 11:22 PM
for portal there is no direct way, you will have to use custom variable and add widget to it and then use client controller script etc.
Includes lot of customizations.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader